Blocked by yahoo smtp server
For some reasons, my mail server has been denied by yahoo smtp server, I can not send email to yahoo.com domain, the mail log is something like this :
B078B14A8008: to=someone@yahoo.com, relay=mta5.am0.yahoodns.net[66.196.118.34]:25, delay=2.9, delays=0.04/0/0.78/2.1, dsn=5.0.0, status=bounced (host mta5.am0.yahoodns.net[66.196.118.34] said: 554 Message not allowed - [PH01] Email not accepted for policy reasons. Please visit http://postmaster.yahoo.com/errors/postmaster-27.html [120] (in reply to end of DATA command))
I have tried changing my mail server using another IP but no luck. I also tried contacting with yahoo webmaster but no responses.After a while digging the problem, I realize that the yahoo mail server does block my domain (which using as mail-from address to send out) and not block my server IP address.
So how did I overcome this ? Suppose that my mail-from address = ads@mydomain.com
The trick is quite easy :
- Filter all outgoing mail destine to yahoo.com to another postfix server / or postfix instance.- Rewrite the mail-from-domain to something else, for exam to : ads@mydomainmail.com before sending to yahoo servers.
- Add the header field Return-To : <ads@mydomain.com> to make sure the users can reply to the original mail from.
- Make the mail-from (after rewrite) to more user friendly, for exam : <ads@mydomainmail.com> to Ads info by mydomain.com - user will see this at their mail client (more beautifull).
Steps in detail :
1. Filter all outgoing mail to yahoo.com to another postfix instance :
Suppose that my main postfix instance listens at [1.2.3.4]:25 and the config files stay at /etc/postfix1.2.3.4/ :
# vim /etc/postfix1.2.3.4/main.cf
transport_maps = hash:/etc/postfix1.2.3.4/transport
# vim /etc/postfix1.2.3.4/transport
yahoo.com smtp:[1.2.3.5]:25 #filter mail to yahoo.com to other postfix instance on the same host
* :
# postmap /etc/postfix1.2.3.4/transport# /etc/init.d/postfix1.2.3.4 reload
# tail /var/log/maillog :
May 5 10:32:47 Postfix postfixOUTGOING/smtp[19854]: D0F3F11B8001: to=<someone@yahoo.com>, relay=1.2.3.5[1.2.3.5]:25, delay=0.05, delays=0.02/0/0.02/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as D90E91340001)
2. Rewrite the mail-from domain and add the Return-To header :
At the 1.2.3.5 postfix instance config dir :
# vim /etc/postfix1.2.3.5/main.cf
sender_canonical_maps = hash:/etc/postfix1.2.3.5/rewritesender
header_checks = regexp:/etc/postfix1.2.3.5/header_checks
transport_maps = hash:/etc/postfix1.2.3.5/transport
# vim /etc/postfix1.2.3.5/rewritesender
@mydomain.com @mydomainmail.com
# vim /etc/postfix1.2.3.5/header_checks
/^(From|from):.* (.*)@(.*)/ PREPEND Reply-To: ${2}@${3}
# vim /etc/postfix1.2.3.5/transport
* smtp:[1.2.3.6]:25
# postmap /etc/postfix1.2.3.5/rewritesender
# postmap /etc/postfix1.2.3.5/header_checks
# postmap /etc/postfix1.2.3.5/transport
# /etc/init.d/postfix1.2.3.5 reload
# tail /var/log/maillog :
May 5 10:32:47 postfix postfixYAHOO/cleanup[19941]: D90E91340001: prepend: header From: ads@mydomain.com from unknown[1.2.3.4]; from=<ads@mydomainmail.com> to=<someone@yahoo.com> proto=ESMTP helo=<mx1.mydomainmail.com>: Reply-To: <ads@mydomain.com>
May 5 10:32:47 postfix postfixYAHOO/smtp[19942]: D90E91340001: to=<someone@yahoo.com>, relay=1.2.3.6[1.2.3.6]:25, delay=0.04, delays=0.01/0/0.01/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as DFD6914A8001)
3. Make the mail-from (after rewrite) to more user friendly :
This step will rewrite the mail-from to : Ads info by mydomain.com
# vim /etc/postfix1.2.3.6/main.cf
header_checks = regexp:/etc/postfix1.2.3.6/header_checks
# vim /etc/postfix1.2.3.6/header_checks
/^(From|from):.* (.*)@(.*)/ REPLACE From: Ads info by mydomain.com <${2}@${3}>
# postmap /etc/postfix1.2.3.6/header_checks
# /etc/init.d/postfix1.2.3.6 reload
# tail /var/log/maillog :
May 5 10:32:47 postfix postfixYAHOO1/cleanup[19946]: DFD6914A8001: replace: header From: ads@mydomainmail.com from unknown[1.2.3.5]; from=<ads@mydomainmail.com> to=<someone@yahoo.com> proto=ESMTP helo=<mx.mydomainmail.com>: From: Ads info by mydomain.com <ads@mydomainmail.com>
May 5 10:32:50 postfix postfixYAHOO1/smtp[19947]: DFD6914A8001: to=<someone@yahoo.com>, relay=mta6.am0.yahoodns.net[98.136.216.26]:25, delay=2.4, delays=0.01/0.01/1.2/1.2, dsn=2.0.0, status=sent (250 ok dirdel)
At last, the message has been delivered to yahoo mail server (status=sent), no more blocking.
That's it.
No comments:
Post a Comment