Welcome to Centmin Mod Community
Become a Member

Postfix delay email

Discussion in 'Domains, DNS, Email & SSL Certificates' started by SFLC, Feb 15, 2017.

  1. SFLC

    SFLC Active Member

    224
    59
    28
    Dec 4, 2016
    The Canadas
    Ratings:
    +112
    Local Time:
    5:50 AM
    1
    10
    Hello,

    I found that my email is delayed when sending to gmail accounts from one of my websites for 5 min.

    This is the entry from maillog

    Code:
    Feb 15 12:30:07 cluster postfix/smtp[12916]: 7C874182490: to=<xxxxxxx@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.195.26]:25, delay=0.58, delays=0.12/0.03/0.11/0.33, dsn=2.0.0, status=sent (250 2.0.0 OK 1487161807 b141si5294152wma.133 - gsmtp)
    What's with the delays, I thought the delay was from the gmail side but i now think the delays are from my server. It's not a postfix issue as my other sites on the same server don't have these delays.

    thanks
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,839
    6,903
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,393
    Local Time:
    1:50 PM
    Nginx 1.13.x
    MariaDB 5.5
    Google-fu'd

    So in your example
    • a (0.12): The time before getting to the queue manager, so the time it took to be transmitted onto the mail server and into postfix.
    • b (0.03): The time in queue manager, so this email didn’t hit the queues, so it was emailed straight away.
    • c (0.11): The time it took to set up a connection with the destination mail relay.
    • d (0.33): The time it took to transmit the email to the destination mail relay.
    that delay isn't slow given it's remote smtp

    Are all sites going through the same gmail smtp account ? they have strict rate limits so you could be hitting those sending limits for gmail smtp ? Tried separate gmail smtp accounts for each site ?
     
  3. eva2000

    eva2000 Administrator Staff Member

    30,839
    6,903
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,393
    Local Time:
    1:50 PM
    Nginx 1.13.x
    MariaDB 5.5
    You can use alias command I setup for postfix = postfixlog to see a summary of your today postfix stats too
     
  4. SFLC

    SFLC Active Member

    224
    59
    28
    Dec 4, 2016
    The Canadas
    Ratings:
    +112
    Local Time:
    5:50 AM
    1
    10
    Ya im not sure @eva2000 as theres no way i'm reaching any limits, the site that has this issue literally just has 1 user right now and thats me. It seems after creating test users with gmail accounts (i have multiple gmail accounts for testing purposes) the first few emails to each user is delayed by 5 min, then this 5 min issue goes away for 24 hrs then its back again.

    This is the strangest problem of all time as it doesnt happen on my other sites and doesnt seem to have anything to do with the server ip etc, no blacklists

    i just dont get it
     
  5. eva2000

    eva2000 Administrator Staff Member

    30,839
    6,903
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,393
    Local Time:
    1:50 PM
    Nginx 1.13.x
    MariaDB 5.5
    Gmail is commonly reported having delayed emails via smtp. If you want faster use Amazon SES smtp :)

    Google search for "gmail smtp delays site:productforums.google.com" and you'll see
     
  6. SFLC

    SFLC Active Member

    224
    59
    28
    Dec 4, 2016
    The Canadas
    Ratings:
    +112
    Local Time:
    5:50 AM
    1
    10
    I'm not using gmail for smtp though, just using sendmail, gmail in this case is just the users email address. whats weird though is that when the 5 min issue occurs, the activation link in the email (which i initially thought the exposed link was causing the issue) popups up, on click, with "suspicious link", but after the 5 min issue is gone, in a new email, there is no suspicious link warning anymore.

    i have proper spf, dmarc and dkim configured and all messages are signed and pass everything in googles show original pages,

    i've reported this to google as a delivery issue through
    Report a delivery problem between your domain and Gmail - Gmail Help

    but at the same time, since its google, im not expecting a reply
     
  7. eva2000

    eva2000 Administrator Staff Member

    30,839
    6,903
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,393
    Local Time:
    1:50 PM
    Nginx 1.13.x
    MariaDB 5.5
    could be end user's ISP has their own blacklist/greylisting policy in place ?
     
  8. SFLC

    SFLC Active Member

    224
    59
    28
    Dec 4, 2016
    The Canadas
    Ratings:
    +112
    Local Time:
    5:50 AM
    1
    10
    i dont think thats the case, im that end user and currently the only user of that site, and im accessing my gmail account directly from gmail.com
     
  9. eva2000

    eva2000 Administrator Staff Member

    30,839
    6,903
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,393
    Local Time:
    1:50 PM
    Nginx 1.13.x
    MariaDB 5.5
    https://productforums.google.com/forum/#!topic/gmail/HVK81f0aGF4
    Have you tried adding the gmail address to user's address book as well ?
     
  10. SFLC

    SFLC Active Member

    224
    59
    28
    Dec 4, 2016
    The Canadas
    Ratings:
    +112
    Local Time:
    5:50 AM
    1
    10
    Ya it's definitely not spam as it always ends up in the inbox after its delivered.

    I just tried adding the email in my contact list and the email went through right away, although im not sure if this will happen again in 24 hrs like it has been for the last few days.

    What i found even stranger in this experience is that since this activation email is from the site through the script im running. if i did this

    Code:
    echo "test" | mail -s "test" -r no-reply@xxxx.cm xxxxx@gmail.com
    then there is no delay and it goes through everytime, to any gmail account with no issues.

    I even stripped all html from the sites email just in case it was that, but no joy. If the adding to address book solution works thats great, but its kinda hard to implement that as the sites gains visitors as i cant have someone signup but then say go add noreply@xxxxxx.com before you press submit or the activation email will not be received for 5 min.

    Im not a big fan of google right now for this, they dont make it easy thats for sure
     
  11. eva2000

    eva2000 Administrator Staff Member

    30,839
    6,903
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,393
    Local Time:
    1:50 PM
    Nginx 1.13.x
    MariaDB 5.5
    some forum and web apps have their own email queue for deferring emails. You might want to investigate that too.
     
    • Like Like x 1
  12. SFLC

    SFLC Active Member

    224
    59
    28
    Dec 4, 2016
    The Canadas
    Ratings:
    +112
    Local Time:
    5:50 AM
    1
    10
    Thanks for your help @eva2000 ill keep looking for a solution, i have a few experiments in mind, but first some sleep as i had to work an overnight shift :sleep:
     
    • Like Like x 1
  13. SFLC

    SFLC Active Member

    224
    59
    28
    Dec 4, 2016
    The Canadas
    Ratings:
    +112
    Local Time:
    5:50 AM
    1
    10
    Hello everyone,

    I tried using: https://toolbox.googleapps.com/apps/messageheader/analyzeheader

    Can anyone help me decipher what this means, I'm still trying to figure out if theres anything I can do about this on the server level, or if this is a google problem

    Code:
    MessageId  
    980f418af2dad0d401c240ca7b70ebc8@sflc.cm
    Created at:    2/18/2017, 9:17:59 PM ( Delivered after 4 mins )
    From:    "XXXX.com" <no-reply@XXXX.com>
    To:    xxxxxxxxxxxx@gmail.com
    Subject:    One more step to go
    SPF:    pass
    DKIM:    pass
    DMARC:    pass
    
    #    Delay    From*            To*    Protocol    Time received  
    0    1 sec    xxxxxx.xxxx.com    →    [Google]    mx.google.com    ESMTPS    2/18/2017, 9:18:00 PM  
    1            →    [Google]    10.28.180.132    SMTP    2/18/2017, 9:18:00 PM  
    2    1 sec        →    [Google]    10.28.180.132    SMTP    2/18/2017, 9:18:01 PM  
    3    4 mins        →    [Google]    10.157.10.195    SMTP    2/18/2017, 9:22:01 PM
    I just don't know how steps 1 to 3 go through or if they're internal to google once they receive the email. This definitely doesn't happen with other email providers, and the email is instantly delivered, so I'm leaning towards this being a google issue. I don't know why it's affecting only my site (not the ip as my other sites aren't affected). I'm on the verge of giving up and just living with this '4' min delay.

    If google was a person I would challenge him to a boxing match!!

    Thanks in advance to anyone that can help
     
  14. SFLC

    SFLC Active Member

    224
    59
    28
    Dec 4, 2016
    The Canadas
    Ratings:
    +112
    Local Time:
    5:50 AM
    1
    10
    This is what i tried so far:

    1.
    Code:
    csf -x
    just for the hell of it, no joy
    2. changed in postfix's main.cf
    Code:
    inet_interfaces = localhost
    to
    inet_interfaces = all
    no joy

    I usually have it as localhost as I don't receive email through the server but rather though zoho and all domain mx's point there not the servers ip. SPF is set to allow the a record though so SPF can pass.

    3. Changed the from email config of one of my other domains to the problematic one...same issue came up, so I don't know what to conclude other than google doesnt like that one domain specifically.

    Any ideas how I can deal with that with google, I filled out an email deliverability report form on their site but they havent gotten back to me yet.

    It would suck to have to move this project to a different domain because google decided to burn my domain, although Im glad they have no issues with the IP as that would be way more complicated to deal with.
     
    Last edited: Feb 19, 2017
  15. eva2000

    eva2000 Administrator Staff Member

    30,839
    6,903
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,393
    Local Time:
    1:50 PM
    Nginx 1.13.x
    MariaDB 5.5
    is this problem domain new to email sending ? how much overall email sending have you done through the domain? how long have you been sending email through this domain ? it could be subject to greylisting and needs to build up reputation for domain, ip and mail server. This is why Amazon SES and 3rd party smtp providers like Sendgrid, Mailgun etc work well is they already have the reputation built up so better mail delivery happens.

    greylisting Greylisting - Wikipedia

    if you want fast delivery, use a 3rd party smtp provider like Amazon SES :)
     
    • Like Like x 1