1

I own a VPS used for hosting about 30 domains. On each domain I have several email accounts. In total more than 150 accounts. In the last couple of weeks, I noticed that sometimes (several times a day, mostly in the peak hours) there are several (form 1 to as much as 10) emails not being sent but instead they get deferred. In the maillog there is a message “Connection refused”. After some time, they eventually are successfully sent. Some are sent after 5 minutes some after 2-3 hours, but they are all sent.

I’m a web designer, with decent knowledge of programming but unfortunately little experience in Linux (Centos7).

After not being able to find the problem myself, I reached to the hosting company of my VPS. They said that indeed they have limited all VPS’s to be able to open only one SMTP socket at the time. They did this as a measure to fight spammers getting their IPs (or whole IP ranges) blacklisted. They offered me to switch to Dedicated or find another host. Since the price of the dedicated server is several times as the price for VPS and I really have no need to switch to dedicated (I host 30 small websites, as already mentioned) I’m trying to find a solution for this problem.

Currently, the deferred emails I force to resend with

postqueue -f

command. But I need to execute this command manually and as many times as there are deferred emails in the queue. Not to mention the need to constantly monitoring the queue for deffered emails. Obviously this is not a solution for my problem.

I tried to schedule a crone to execute a postqueue command periodically every 5 minutes but after first execution I got error something like Unknown command postqueue or command not found or something similar… I guess it has something to do with environmental variables but this is out of my scope of knowledge now. Besides that if there are 10 defered mails in the queue only one would be send with each cron execution. So the last mail would be sent after 50 minutes which is still not a great solution. I would need a cron to run something like this Run crone every 5 minutes (or something)

while (there are deferred emails in the queue)
{
    postqueue -f
}

There arises another issue: What if the email is deffered because of another reason rather than Connection refused… for example destination host is not reachable at the moment... Than this cron would never finish…!?! What about the performance of this cron solution in general?

Have you had any experience with similar problem? How do I live with this SMTP socket restriction on my VPS. Should I find another host or switch to dedicated instead?

This might be relevant: I use centos 7 on my VPS, and have Plesk panel for domain administration.

Any help would be great. Thank you!

EDIT:

I managed to schedule a cron with this command

/sbin/postqueue -f

to run every 5 minutes (0,5,10,15,20,25,30,35,40,45,50,55 * * * *). But, as explaind above, this is still not a perfect solution.

0 Answers0