Email delay when receiving emails


When I send myself an email I have to wait like over 30 seconds or so before it arrives. If I send it to my hotmail it arrives in about 5 seconds. I also used to use GMail in which it arrived almost instantly too, I have only just moved my mail from Gmail to my server, and this delay started.

So is there is some delay or additional processing it does before I receive it? Can this be sped up?

I am a web developer and very frequently test email scripts in websites, and this delay is really frustrating me.


The delay could be cause by Greylisting if you have that active.

Otherwise to find out where the delay happens, you’d need to check the logfiles (/var/log/mail.log), and read the mail headers (where all intermediate systems record the “Received” lines, saying when they received the mail from where).

I tell you what… I had Spam and Virus checking enabled. I disabled Virus checking and now its faster. Shame this takes up so much time, would Hotmail and GMail have virus checkers, if so how come theirs are so fast with so many users when on this server there are only a few users.

I can say from experience that the virus check does NOT generally cause delays of 30 seconds; on my system it works nearly in real-time. When I send myself a mail, it arrives a few seconds later.

What kind of server do you have? CPU/memory and such. Is it a virtual machine? Do you use the ClamAV server, or client mode?

I’ve got a 2Gb Linode There’s only about 10 websites on it, with about 3 users using email. My monitoring system shows the server CPU/RAM/LOAD very low. So I dont think its server issue.

I have whatever spam filter comes with Virtualmin/Webmin by default, I have not changed it. So I guess thats spamassassin?

Wait, you said you turned off virus scanning to get the delivery be faster? Spam and virus scanning are two totally different things. For spam, yep, Virtualmin uses Spamassassin.

For virus scanning, it uses ClamAV, which can be set to server or client mode (you were presented that choice when the first-start wizard was executed, and you can change it later under Email messages / Spam and Virus scanning).

You might try setting both spam and virus scanning to “spamd / clamdscan”, which is much faster (because it doesn’t need to start up a process for each scan), but uses more resources (RAM mostly, because the scanner service stays in memory).

You might also want to watch process/resource behavior using atop when an email is being received. Then you can see if there’s shortage of CPU power while clamscan starts up or so. Although I’d be surprised if even on a slow system, clamscan needed 30 seconds to start.

Oh yeah sorry I got mixed up! I have turned off virus scanning, so would have been using whatever VM came with (so ClamAV from what you say).

I will give your suggestion a go sometime, not sure when though as I am fairly busy and now email is receiving fine I may be Ok not having virus scanning as the computer usually has it on incoming email, although I am using a Mac so so not sure what implications on receiving a virus in an email will be, maybe nothing as its a Mac, I dont open dodgy files anyway. So I might leave it off to get better server performance.