postfix not sending mail in Ubuntu 15.04

889 Views Asked by At

I have installed postfix in Ubuntu as Mail server. But the problem is I am not able to send mail from PHP mail function.

PHP Code

$to =  "[email protected]";
$subject = "Test mail";
$message = "Please ignore this e-mail.";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: 'xyz'<[email protected]>";

Error log

postfix/pickup[38916]: 10C6B226019C: uid=33 from= postfix/cleanup[38918]: 10C6B226019C: message-id=
<[email protected]> postfix/qmgr[38917]: 10C6B226019C: from=, size=499, nrcpt=1 (queue active) postfix/smtp[38942]: connect to ASPMX.L.GOOGLE.COM[2404:6800:4003:c02::1b]:25: Network is unreachable postfix/smtp[38942]: 10C6B226019C: to=, relay=ASPMX.L.GOOGLE.COM[74.125.68.26]:25, delay=2, delays=0.07/0/1.3/0.62, dsn=5.7.1, status=bounced (host ASPMX.L.GOOGLE.COM[74.125.68.26] said: 550-5.7.1 [111.93.202.110
12] Our system has detected that this message is 550-5.7.1 likely unsolicited mail. To reduce the amount of spam sent to Gmail, 550-5.7.1 this message has been blocked. Please visit 550-5.7.1 https://support.google.com/mail/?p=UnsolicitedMessageError 550 5.7.1 for more information. 17si43634365pfq.99 - gsmtp (in reply to end of DATA command))

postfix/cleanup[38923]: 1325D226019D: message-id=<[email protected]> postfix/bounce[38940]: 10C6B226019C: sender non-delivery notification: 1325D226019D postfix/qmgr[38917]: 1325D226019D: from=<>, size=3069, nrcpt=1 (queue active) postfix/qmgr[38917]: 10C6B226019C: removed postfix/local[38937]: 1325D226019D: to=, relay=local, delay=0.08, delays=0.04/0/0/0.04, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION") postfix/qmgr[38917]: 1325D226019D: removed

1

There are 1 best solutions below

0
On

It looks like gmail is marking it as spam and dropping it, and one of the posibles reasons can be because he can't trust your server.

You can try to establish a reverse DNS and maybe if the gmail servers can resolve a DNS lookup, they would'nt discard the message from your server.

In this article you can read a guide about configuring a postfix server to send messages with gmail.