开发者

Send authenticated mail through sendmail

开发者 https://www.devze.com 2023-01-22 13:27 出处:网络
I\'m using sendmail to send a bun开发者_运维问答ch of e-mails (I really have to send this e-mails, unfortunately) through php. The e-mail began to get into gmail and yahoo\'s SPAM boxes as soon as I s

I'm using sendmail to send a bun开发者_运维问答ch of e-mails (I really have to send this e-mails, unfortunately) through php. The e-mail began to get into gmail and yahoo's SPAM boxes as soon as I stopped using my domain SMTP server, and started using the server's sendmail facility (I separated my domain name provider from my host, which is now Amazon).

After studying a little, I realized that I could solve this problem just by sending the e-mail authenticatedly (i.e. through my domain's SMTP server). Can I do that through configuration in sendmail? That way, I wouldn't need any changes on my application, only on my server infrastructure.

The headers I'm receiving (from an email at gmail)

Delivered-To: ***********@gmail.com
Received: by 10.227.152.2 with SMTP id e2cs188839wbw;
        Fri, 29 Oct 2010 03:39:45 -0700 (PDT)
Received: by 10.100.13.16 with SMTP id 16mr263366anm.209.1288348783979;
        Fri, 29 Oct 2010 03:39:43 -0700 (PDT)
Return-Path: <apache@ip-10-194-150-64.ec2.internal>
Received: from ip-10-194-150-64.ec2.internal (ec2-75-101-144-206.compute-1.amazonaws.com [75.101.144.206])
        by mx.google.com with ESMTP id x32si2412082vcr.72.2010.10.29.03.39.43;
        Fri, 29 Oct 2010 03:39:43 -0700 (PDT)
Received-SPF: neutral (google.com: 75.101.144.206 is neither permitted nor denied by best guess record for domain of apache@ip-10-194-150-64.ec2.internal) client-ip=75.101.144.206;
Authentication-Results: mx.google.com; spf=neutral (google.com: 75.101.144.206 is neither permitted nor denied by best guess record for domain of apache@ip-10-194-150-64.ec2.internal) smtp.mail=apache@ip-10-194-150-64.ec2.internal
Received: from ip-10-194-150-64.ec2.internal (localhost [127.0.0.1] (may be forged))
    by ip-10-194-150-64.ec2.internal (8.13.8/8.13.8) with ESMTP id o9TAdhxQ017836
    for <*************e@gmail.com>; Fri, 29 Oct 2010 06:39:43 -0400
Received: (from apache@localhost)
    by ip-10-194-150-64.ec2.internal (8.13.8/8.13.8/Submit) id o9TAdhHk017833;
    Fri, 29 Oct 2010 06:39:43 -0400
Date: Fri, 29 Oct 2010 06:39:43 -0400
Message-Id: <201010291039.o9TAdhHk017833@ip-10-194-150-64.ec2.internal>
To: ***********@gmail.com
Subject: Esqueci minha senha
From: Cidade dos Bicos <*****************@cidadedosbicos.com.br>
X-Mailer: Cidade dos Bicos
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Thanks


no that's not the real issue here, it's all about headers, if you send the correct heeaders attached to the mail you won't end up getting into the spam box if you don't actually spam them ;)

edit:

here is a site going through what headers and how they should be set http://www.transio.com/content/how-pass-spam-filters-php-mail


The following code has worked for me in the past. Give it a try and let me know.

$to = "someguy@gmail.com";
$subject ="Howdy Pardner?";
$message="I'm riding west, join me"; 
$headers = 'From: me@philar.com' . "\n" .
           'Reply-To: me@philar.com' . "\n" .
       'Content-Type: text/html; charset="utf-8"' . "\n" .
           'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message,$headers);


For further referral: all my problems were because of bad configured DNS entries. Terms like MX, mx CNAME, PTR, DKIM should be in your veins when you decide to send e-mail.

This is a good reference: http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html

0

精彩评论

暂无评论...
验证码 换一张
取 消