Cf8d02137d2eb1e56c184d43e2863106336c555e
By:
pairoj1

why droplet in digital Ocean can't send php mail to hotmail and gmail ?

August 11, 2015 1.2k views
PHP Email

why droplet in digital Ocean can't send php mail to hotmail and gmail ?
Hotmail and gmail block mail form digital Ocean ??

my digitalOcean http://128.199.146.94/omnama.com/

I'm beginner use ubuntu on my website but I don't know how to set ubuntu sent mail to gmail ,hotmail?

I'm install sudo apt-get install postfix set by internet
after I'm use this code but Why log tell me have sent to sawasdee@outlook.com But I check in hotmail and gmail can't see my email. why php mail can't sent ??????????????????????

this log and coding:

<?php 
$strTo ="aroidee@live.com";
    $strSubject = "=?UTF-8?B?".base64_encode("mail1 hello")."?=";
    $strHeader .= "MIME-Version: 1.0' . \r\n";
    $strHeader .= "Content-type: text/html; charset=utf-8\r\n"; 
    $strHeader .= "From: sawasdee company<sawasdee@outlook.com>\r\nReply-To: sawasdee@outlook.com";
    $strMessage = "
      <body>
    hello world!
 </body>";

    $flgSend = @mail($strTo,$strSubject,$strMessage,$strHeader);  // @ = No Show Error //
    unset($flgSend,$strTo,$strSubject,$strHeader,$strMessage);


    $strTo ="sawasdee@outlook.com";
    $strSubject = "=?UTF-8?B?".base64_encode("mail2 sawasdee")."?=";
    $strHeader .= "MIME-Version: 1.0' . \r\n";
    $strHeader .= "Content-type: text/html; charset=utf-8\r\n"; 
    $strHeader .= "From: sawasdee company<sawasdee@outlook.com>\r\nReply-To: sawasdee@outlook.com";
    $strMessage = "
      <body>
      sawasdee world!</body>";
        $flgSend = @mail($strTo,$strSubject,$strMessage,$strHeader);  // @ = No Show Error //
    unset($flgSend,$strTo,$strSubject,$strHeader,$strMessage);

?>

Why log show can sent complete but I check in hotmail and gmail can't see in junk ,Trash,inbox not found?

Jul 30 05:47:17 sawasdee1 postfix/pickup[24607]: D79DF120472: uid=33 from=<www-data>
Jul 30 05:47:17 sawasdee1 postfix/cleanup[24669]: D79DF120472: message-id=<20150730094717.D79DF120472@sawasdee1>
Jul 30 05:47:17 sawasdee1 postfix/qmgr[24608]: D79DF120472: from=<www-data@sawasdee1>, size=500, nrcpt=1 (queue active)
Jul 30 05:47:17 sawasdee1 postfix/pickup[24607]: DA29812006F: uid=33 from=<www-data>
Jul 30 05:47:17 sawasdee1 postfix/cleanup[24669]: DA29812006F: message-id=<20150730094717.DA29812006F@sawasdee1>
Jul 30 05:47:17 sawasdee1 postfix/qmgr[24608]: DA29812006F: from=<www-data@sawasdee1>, size=505, nrcpt=1 (queue active)
Jul 30 05:47:19 sawasdee1 postfix/smtp[24675]: DA29812006F: to=<aroidee@live.com>, relay=mx1.hotmail.com[65.54.188.110]:25, delay=1.2, delays=0/0.01/0.58/0.62, dsn=2.0.0, status=sent (250  <20150730094717.DA29812006F@sawasdee1> Queued mail for delivery)
Jul 30 05:47:19 sawasdee1 postfix/qmgr[24608]: DA29812006F: removed
Jul 30 05:47:19 sawasdee1 postfix/smtp[24674]: D79DF120472: to=<sawasdee@outlook.com>, relay=mx1.hotmail.com[65.55.92.168]:25, delay=1.5, delays=0.02/0.01/0.65/0.79, dsn=2.0.0, status=sent (250  <20150730094717.D79DF120472@sawasdee1> Queued mail for delivery)
Jul 30 05:47:19 sawasdee1 postfix/qmgr[24608]: D79DF120472: removed
1 Answer

Gmail and Outlook got spam filters. If you havent got the proper setup on your server, gmail and outlook will mark it as spam and put it in your spam box. You can protect your mail server and get up your "spam score" by using dkim, spf, etc.

If outlook and gmail wouldnt use spam filters, people all around the world could fill up your inbox with 1000 of mails with just a small php script. I suggest you gain some more information about linux systems and specially mail servers.

Have another answer? Share your knowledge.