1

Topic: iRedmail API

==== Required information ====
- iRedMail version: 0.8.5
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Linux/BSD distribution name and version: Debian/wheezy
- Related log if you're reporting an issue:
====

Hello Zhang,

Does iRedmail provide any API, so that I can call it for sending an email from a PHP webpage ?

Currently I am using a phpmailer (http://sourceforge.net/projects/phpmailer/) that comes with the Simfatic Registration Form (https://github.com/simfatic/RegistrationForm).

It is successfully sending emails. But the problem is that the emails are going to the spam folder. The reasons may be:
1. phpmailer sends out emails without authenticating with the mail server.
2. The headers are not correct.

I have checked the header of the email arrived in the Spam folder. It doesn't have spf and dkim "pass". So I just thought of some iRedmail API that I can call instead of calling the phpmailer's API. Please suggest.

Header Follows
=========================
Delivered-To: myemailid@gmail.com
Received: by 10.182.48.42 with SMTP id i10csp227958obn;
        Wed, 30 Oct 2013 05:39:04 -0700 (PDT)
X-Received: by 10.68.129.40 with SMTP id nt8mr4974931pbb.108.1383136743690;
        Wed, 30 Oct 2013 05:39:03 -0700 (PDT)
Return-Path: <www-data@server.mydomain.com>
Received: from server.mydomain.com ([100.101.102.103])
        by mx.google.com with ESMTP id hb3si1822530pac.152.2013.10.30.05.39.03
        for <myemailid@gmail.com>;
        Wed, 30 Oct 2013 05:39:03 -0700 (PDT)
Received-SPF: neutral (google.com: 100.101.102.103 is neither permitted nor denied by best guess record for domain of www-data@server.mydomain.com) client-ip=100.101.102.103;
Authentication-Results: mx.google.com;
       spf=neutral (google.com: 100.101.102.103 is neither permitted nor denied by best guess record for domain of www-data@server.mydomain.com) smtp.mail=www-data@server.mydomain.com
Received: from localhost (server.mydomain.com [127.0.0.1])
    by server.mydomain.com (Postfix) with ESMTP id 6D61E638EC
    for <myemailid@gmail.com>; Wed, 30 Oct 2013 12:39:02 +0000 (UTC)
X-Virus-Scanned: Debian amavisd-new at d1stkfactory
Received: from server.mydomain.com ([127.0.0.1])
    by localhost (server.mydomain.com [127.0.0.1]) (amavisd-new, port 10024)
    with ESMTP id EcJ9IxOki5_m for <myemailid@gmail.com>;
    Wed, 30 Oct 2013 12:38:35 +0000 (UTC)
Received: by server.mydomain.com (Postfix, from userid 33)
    id 31B10638ED; Wed, 30 Oct 2013 12:38:35 +0000 (UTC)
To: Aniyan Rajan <myemailid@gmail.com>
Subject: Your registration with mydomain.com
X-PHP-Originating-Script: 0:class.phpmailer.php
Date: Wed, 30 Oct 2013 12:38:35 +0000
From: My Domain <postmaster@mydomain.com>
Message-ID: <764edf7a471f02245c9944f5fe1a6d1e@www.mydomain.com>
X-Priority: 3
X-Mailer: PHPMailer (phpmailer.sourceforge.net) [version 2.0.4]
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="utf-8"

Hello Aniyan Rajan
-----Email Body----

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: iRedmail API

Just send via SMTP protocol, no addition API required.

P.S.

*) Send with SMTP auth will trigger Amavisd to sign DKIM keys.
*) Add SPF DNS record for your mail domain will help.

3

Re: iRedmail API

ZhangHuangbin wrote:

Just send via SMTP protocol, no addition API required.

P.S.

*) Send with SMTP auth will trigger Amavisd to sign DKIM keys.

okay, I will try that. I will check if phpmailer does so. Thanks.

*) Add SPF DNS record for your mail domain will help.

Yes, I have added the SPF DNS record already. But the email header doesn't show the 'pass' due to some reason.

4

Re: iRedmail API

aniyan.rajan6 wrote:

Yes, I have added the SPF DNS record already. But the email header doesn't show the 'pass' due to some reason.

You can verify your SPF record with some online tools. For example, http://www.kitterman.com/spf/validate.html (just search "spf verify" in google)

5

Re: iRedmail API

Zhang,

Thank you for the help. Now the spf and dkim are coming properly in the header, when the email is sent by phpmailer. But the dmarc is not included in it. Don't know why.

Header Follows:
===============
Received-SPF: pass (google.com: domain of mail@mydomain.com designates 100.101.102.103 as permitted sender) client-ip=100.101.102.103;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of mail@mydomain.com designates 100.101.102.103 as permitted sender) smtp.mail=mail@mydomain.com;
       dkim=pass header.i=@mydomain.com
Received: from localhost (server.mydomain.com [127.0.0.1])
    by server.mydomain.com (Postfix) with ESMTP id BE107638ED
    for <myemailid@gmail.com>; Thu, 31 Oct 2013 02:33:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=
    mydomain.com; h=content-type:content-type
    :content-transfer-encoding:mime-version:x-mailer:message-id
    :subject:subject:from:from:to:date:date; s=dkim; t=1383186777;
     x=1384050778; bh=EL8PM8rSy53IgQH/66N81plWFX8atd7trJUS8X7vX2A=; b=
    WuE+o6M4vQYR7RLm5Pi+w4QisRoeueueuEEEUEOEUEUEUUEEEUOO<>PPPP+QSbHbuy
    wzl7AffEPHDTHHDhhHdHHTTNTHTTTTTHnCDnrnINNHRNNlCKJ/h2hcJR/9QQo3xmh
    Wo50HQ+6gjXIE734hzQwZffxlAaMt1XHSWxPlMBnRCA=

6

Re: iRedmail API

I'm sorry that iRedMail doesn't have DMARC related stuffs by default, so please try to solve it yourself.