DeeEmm

Pragmatism in code

Waxing lyrical about life the universe and everything software related since lunchtime 2006.

Fix your painfully slow PHP mail() function.

Fix your painfully slow PHP mail() function.

Having moved all of my sites to the Excellent Digital Ocean hosting I noticed that on some sites the php mail function seemed to be painfully slow and in some cases threw up some error messages telling me that it had failed. Googling didn't turn up too much in the way of solutions, most information seemed to suggest that the sendmail or postfix packages be installed instead.

Whilst sendmail and postfix are both great solutions, I did not really want to install a fully fledged mail server on my box as all email handling for my domains is handled on a separate server. It seemed like too much of a waste of resources so I decided to simply fix the issue with the php mail() function. 

After doing a bit of digging I discovered that the issue lay with the hosts file. The host info was incorrect.

Editing the hosts file is pretty easy to do, but first you will need to know what the current hostname is set to. To do this simply type in the following command at the command prompt

...
Continue reading
2783 Hits
0 Comments