Yahoo and Postfix

How-To: Postfix configuration to reduce Yahoo temporary deferrals using Transport Maps 26

Yahoo and PostfixIf you’re getting “temporarily deferred” Postfix log entries when trying to send mail to Yahoo! that look like this:

host[] refused to talk to me: 421 4.7.0 [GL01] Message from ( temporarily deferred - 4.16.50. Please refer to


status=deferred (host[] said: 451 Resources temporarily unavailable. Please try again later [#4.16.1].

then you’re not alone. Yahoo’s mail servers have a reputation among mail server admins of being, well, downright finicky when it comes to accepting large volumes of mail. If you’re sending a large volume of legitimate mail (such as a newsletter), Yahoo is very picky about how much it will allow through at full speed before spitting out 421 “Yahoo temporarily deferred” error messages, or 451 “Yahoo resources temporarily unavailable”, or greylisting, or otherwise temporariliy blocking your Postfix server from sending mail to Yahoo mail recipients.

Reading the suggestions at is a good start. Before doing any steps in this how-to, I recommend making sure your Postfix configuration is fully compliant with Yahoo’s suggestions (including the use of DKIM). But once you’ve done all that, if you’re still getting deferrals, then maybe you could benefit from setting up a custom transport for Yahoo (and any other stubborn mailers) using the transport_maps_initial_destination_concurrency_destination_concurrency_limit_destination_rate_delay, and _destination_recipient_limit settings in Postfix.

How it Works

First, I have to admit that sometimes, the inner workings of Postfix are voodoo to me. I’m not a programmer, and the Postfix documentation is completely geared toward programmers. However, after trudging through Postfix mailing list archives and experimenting a bit, this is how I understand it. Postfix is highly efficient, and pretty smart in its default configuration. It tries to deliver as much of your outbound mail as possible as quickly as possible.  But with a stubborn MTA like Yahoo (and sometimes Hotmail), you need to force Postfix to slow down its uber-efficient approach.

So, using transport maps, you can tell Postfix to watch out for emails to specific domains (like Yahoo) and treat them a bit differently.

Step 1: Setting up the Transport Maps

The first step is to determine which domains you want to treat differently. Obviously, in this example, we’re trying to set up something to eliminate (or at least reduce) Yahoo’s deferrals. So edit the /etc/postfix/transport file and create some maps that tell Postfix exactly which email domains are going to get the special “Yahoo” treatment. The email domain goes on the left, and the name of your custom transport goes on the right (always followed by a colon). The most basic approach would be to specifically list all the Yahoo email domains you want to cover in your /etc/postfix/transport file  like this:

# Yahoo (USA)       yahoo:       yahoo:  yahoo:

# Yahoo (INTL)        yahoo:        yahoo:        yahoo:        yahoo:        yahoo:        yahoo:     yahoo:     yahoo:     yahoo:     yahoo:     yahoo:     yahoo:     yahoo:     yahoo:    yahoo:    yahoo:    yahoo:    yahoo:    yahoo:    yahoo:    yahoo:    yahoo:    yahoo:    yahoo:    yahoo:    yahoo:        yahoo:        yahoo:        yahoo:
yahoo.en        yahoo:        yahoo:        yahoo:        yahoo:        yahoo:        yahoo:        yahoo:        yahoo:        yahoo:        yahoo:        yahoo:        yahoo:        yahoo:        yahoo:

However, listing all those domains forces you to stay up to date with any new domains that Yahoo might launch. So a smarter approach would be to two transport maps: one that’s a regular hash table, and another with a regular expression that simply catches any domain that starts with yahoo.

First, put and in your /etc/postfix/transport file, like this:

# Yahoo       yahoo:  yahoo:

Once you’re done editing the /etc/postfix/transport file (and after every edit from now on), remember to do:

postmap /etc/postfix/transport

to build the transport.db file.

Next, create a file called /etc/postfix/transport.regexp that looks like this:

# Yahoo Wildcards
/yahoo(\.[a-z]{2,3}){1,2}$/  yahoo:

That will catch all “yahoo dot anything” domains. Note that you don’t need to run postmap on regular expression tables, so now you’re ready to tell Postfix how to read your transports.

Step 2: Include the New Custom Transports in

As always, before messing with /etc/postfix/, make a backup. Then add the following lines at the bottom:

yahoo     unix  -       -       n       -       -       smtp
        -o syslog_name=postfix-yahoo

This tells Postfix that the transport called “yahoo” gets handed off to the Postfix smtp process, and the -o syslog_name option tags the use of this transport in the mail log so I easily tell when this transport is used.

Step 3: Create Custom Settings in

The third step of the process is to create some custom settings in your file to tell Postfix exactly what to do differently when it encounters an outbound mail domain that matches your transport maps. Back up your /etc/postfix/ file, then add these lines:

transport_maps = hash:/etc/postfix/transport, regexp:/etc/postfix/transport.regexp

yahoo_initial_destination_concurrency = 1
yahoo_destination_concurrency_limit = 4
yahoo_destination_recipient_limit = 2
yahoo_destination_rate_delay = 1s

This tells Postfix to check your /etc/postfix/transport and /etc/postfix/transport.regexp files to look up which domains you’ve mapped to which transport, then it sets four specific configurations for the “yahoo” transport:

  • yahoo_initial_destination_concurrency = 1 will start out slowly by only sending one message per SMTP connection to a Yahoo’s MTA.
  • yahoo_destination_concurrency_limit = 4 after starting out slowly with just 1 message, Postfix will increase to allow up to four messages per SMTP connection to a Yahoo MTA.
  • yahoo_destination_recipient_limit = 2 will send the same message to no more than 2 recipients at a time
  • yahoo_destination_rate_delay = 1s will add a 1 second delay between the messages

This is where the Postfix voodoo kicks in for me, so feel free to experiment with these settings and tweak to your liking. The destination concurrency limit and the rate delay are the two you’ll probably want to tinker to keep Yahoo happy. Depending on your mailer reputation, they’ll be more strict or more relaxed on what they’ll allow for these two settings. The above settings that happen to work for my needs, but I still tweak them to experiment, and if you have a configuration that works well with Yahoo (or if you have other custom transports that help increase delivery), please feel free to share them in the comments.

Step 4: Restart Postfix and Test

Now you’re ready to try things out. Start the Postfix configuration with:

service postfix restart

You can’t just do a postfix reload, because changes to the require a full restart. Finally, do a tail -f on your maillog. On my CentOS system, that’s:

 tail -f /var/log/maillog

Now send a message to a Yahoo test account (I’m assuming you have an test account) from or through your Postfix server. If everything worked right, you should see log entries that start with the date, local hostname, and then say postfix-yahoo/smtp. These are the messages that are being diverted through your new transport!

After using these settings for a few mailings, I’ve seen a drastic reduction in the amount of time it takes to deliver tens of thousands of opt-in email to Yahoo recipients. Hopefully, they’ll work for you, too!

Your feedback and comments are welcome below, and I’m especially interested to hear of any other custom transports you may be using, as well as your experiences with different settings for Yahoo.

Further Reading:


  • Casey

    Thanks for posting this – it was helpful.

    In case it helps someone else:

    I also had a problem with my queue – it was loaded with deferred messages and Postfix kept hitting Yahoo with a large batch on every run through the deferred queue, and the messages were then being rejected by Yahoo and going back into the queue.

    I emptied the queue by holding all of the Yahoo destined mail and writing a script that released and immediately delivered (with postsuper -H and postqueue -i) 1 message every 10 seconds.

  • Helo Guys,
    I tried to implement the solution here but it just wont work.

    It seems that Postfix does not create the directory /var/spool/mail/private/yahoo, check out the log files:

    Dec 15 11:38:04 mxcluster postfix/qmgr[12435]: warning: connect to transport private/yahoo: No such file or directory
    Dec 15 11:38:04 mxcluster postfix/qmgr[12435]: warning: connect to transport private/retry: No such file or directory
    Dec 15 11:38:04 mxcluster postfix/qmgr[12435]: 0FB2720F7B6: to=, relay=none, delay=0.05, delays=0.05/0.01/0/0, dsn=4.3.0, status=deferred (mail transport unavailable)

    So I checked the queue folder and in fact, there was no yahoo directory in the private queue folder.

    I checked the “postfix-files” file and could not understand how to configure postfix to create the folder.

    Can anybody help please?

    Thanks in advance.


    • Its working!

      The problem was because I added the lines at the beginnig of the file.
      When I moved it to the end of the file, it just worked.

      A small detail that makes a huge difference.

      Thanks guys.


      • Glad to hear it, Rafael. Hope your deliverability with Yahoo improves as a result!

        • Hi Steve.
          I’m still having a hard time to deliver to other providers.
          Messages go to deferred queue and when postfix try to deliver, it sometimes fails and all goes back to deferred queue.

          Is there anyway I can adjust postfix to stop trying delivering for some time in case of 4XX error messages?

          When this happens, postfix keeps trying to deliver when a temporary block is active. My biggest problem here is because postfix wont wait enough time to resend the messages, keeping the block active sometimes.

  • chris

    Thanks for this post. It has helped us tremendously after trying to deal with Yahoo with little success.

    The only problem we’re having still is that our regional former baby bell (SBC) is part of the Yahoo congolmerate, so a large percentage of consumers in our area use Yahoo whether they know it or not. Any of those consumers who have their own domains through yahoo end up using yahoo mail servers, but the domain in their address isn’t yahoo so they bypass the yahoo transport maps I have set up. So I still have to constantly monitor email because these bypassed yahoo mails end up getting through periodically and Postfix delivers them faster than my yahoo transport throttling.

    Far as I can tell, despite Yahoo’s best practices docs and misleading deferral messages, the only thing they seem to care about is delivery frequency. Send email to them too fast, and you get deferred. Drilbble it through and it doesn’t really matter what you send. At least that’s been my experience.

    Unfortunately, at the level of throttling we have to do to get all our messages out, we aren’t going to be able to deliver all our Yahoo mail on the same day in the near future. About the only solution I can come up with is to throw more servers at the problem. Waste of resources, but other than encouraging anyone and everyone not to use yahoo for email, I don’t have much of a choice.

    • Hi, Chris. Thanks for your comment. And you’re (unfortunately) 100% correct: the best solution we’ve come up with for Yahoo is to dribble them in, and throw more servers at it. What a waste. About half of our 500K person newsletter list has a Yahoo domain, and even with the fixes in this post, those addresses still clog our Postfix deferred queue for 2-3 days after the send. I’m currently setting up a dedicated machine to run multiple VMs. Hopefully quadrupling the number of outbound servers we use will cut our delivery to 25% of what they currently are. Same-day delivery would be nice. 🙂

      • Try to use a set of postfix instances each one using a dedicated outbound ip address to improve deliverability to yahoo, hotmail etc. Yahoo still checking domainkey as checking DKIM and SPF. Try use this three things. Maybe it work… maybe not… it’s hard days of deliverability we are living…

        • Dave

          You can also use

          -o smtp_bind_address=A.B.C.D

          on the transport in to set the outbound IP.

          That alone won’t help much, but couple it with a script like this that is configured as a transport map ( and it’s a pretty elegant solution to randomizing the outbound IP without having the overhead of multiple postfix instances. (disclaimer: I did not write this script, only relied on it for setting up random outbound IP mapping)

          This allows you to spread out the delivery across any number of available IPs that you have. Of course, you’ll want to make sure that SPF, DKIM, and reverse DNS are configured for each IP, but you’d have to do that with separate instances as well.

  • chris

    I don’t know if this would help anybody else, but one of the things I’ve done is created a duplicate transport file. I call it transport.stopyahoo.

    It has lines that push yahoo mail directly to the deferred queue; defer: defer: defer:

    I also have a similar file that contains my “valid” yahoo transports (transport.startyahoo).

    Then, I’ve set up a couple of simple shell scripts that copy the file, remap it, and restart postfix;

    cp transport.stopyahoo transport
    postmap ./transport
    postfix reload

    So, when I start seeing deferrals, I run the script and it effectively stops yahoo delivery to all known yahoo domains in my transport file. I generally wait 15 to 30 minutes and then run the script that reverses it back out and starts up delivery again (that one includes a postqueue -f command to get the messages back out of the deferred queue).

    It’s not the most elegant solution, but I’ve found that if I don’t intervene when Yahoo starts deferring, the problem gets progressively worse. First I’ll get 421 messages (deferred). If I don’t stop the server from attempting to deliver, I’ll get 451 (iirc) messages (server refused to talk to me). Once I get those messages, I sometimes have to wait as long as 4 hours to get Yahoo to accept delivery.

    • Wondering if you could write a script that runs every 60 seconds and greps the maillog for Yahoo 4XX messages, and then launches the “defer Yahoo” script for you, wait X minutes, grep the most recent Y lines of the maillog for Yahoo deferrals, if none found (in the limited range), run the reverse script and flush the queue. Like you, I find managing Yahoo after the send to be a very hands-on experience. I’m trying to figure out how to set it, and forget it. 🙂

      • chris

        That would definitely be ideal and something I’ve given some thought to. It’s a bit beyond my linux/scripting expertise.

        You could use tail -f on maillog and redirect that to a temp file. Probably use grep to filter just yahoo and just deferral messages.

        Then you could periodically cat that temp file and pipe it into wc -l to get a line count, which would be a deferral count if your grep’s were set up right. Right after that, you could cat /dev/null to your temp file to clear it out so that file would be empty and let the file fill up again from the tail command.

        How to deal with that wc -l result is a little beyond my expertise without a little researching, and I suspect there’s probably a better approach than the above.

        You’d also need a way to turn delivery back on. About the only way to do that would be some sort of timed process – if deferrals reach a threshold, stop yahoo delivery, wait 30 minutes then start yahoo delivery and start the deferral log scan again.

      • Dave

        swatch is built specifically for tailing logs and taking action based on matched patterns. It’s fairly easy to install and configure and might save some time over a home-grown method.

  • ragiel

    Hi Steve,
    Im ragiel from indonesia,

    thx for the post,

    i want to ask something, i have a newsletter email with postfix. and it sent to all my client every days, its contain more than 20000 emails a days. mostly to yahoo and gmail. the question is could you give me suggestion for /etc/postfix/ configuration.


  • Clean and precise.
    THX a lot

  • Great! Worked perfectly in our Postfix/CentOS e-mail
    marketing server, thank you very much for the good work.

  • Youngmoon Goh

    That’s a really good solution to me.
    Thank you very much.

  • Pingback: How-To: Postfix configuration to reduce Yahoo temporary deferrals using Transport Maps « Linux T&T()

  • John

    That’s funny. I sent ONE message to Yahoo, and subsequent e-mails are being deferred. Remind me again why anyone even still uses Yahoo? Why is the company even still around?

    • Hey, John. I know. They still are the most “stingy” of the freemail providers when it comes to inbound mail. 🙁

  • HI,

    After applying this, all mail are going fine in postfix but yahoo id are in mail queue with remarks “mail transport unavailable”. Pls suggest.

    • I’d check the settings in the conf files. Sounds like you made a typo.

  • Nived

    i have tried this but it is not working properly now. now my mails are getting deferred and gets expired due to user complaints . so i want to reduce this deferrel issue as soon as possible i have checked all my ips in spamhaus and multirbl.valli for blacklist checking none are listed so far . but the problem is i am not able to sent any mails to yahoo id ,all mails are getting deferred .

    hoping you would replay to me with a new solution for this yahoo diffreral issue.

    thank you .

  • Nived

    hii, i have followd your ways toreduce Yahoo temporary deferrals on postfix . It worked fine in the begining but now it is not working for me . All my mails are getting deffered . Can you please help me to sent my mails to yahoo users. hope you get me with a new way to sent mails to yahoo again . Thank you , Nived.k

  • Cesar

    It is to send more slowly for a given server MX ? Or is it only possible for domain …