Solved

Why does php mail() take 30 seconds to run on my VPS?

Posted on 2011-02-16
1
337 Views
Last Modified: 2012-05-11
I was running a website on a shared hosting account.  Part of this website involved sending a lot of messages via PHP mail().  Unfortunately, all shared hosting providers I could find had a cap on how many emails could be sent per hour.

So, I decided to get a VPS.  I am cheap, so I thought I would get an unmanaged one with cpanel.  Everything is fine and dandy, I have everything up and running.  The only problem I have, is that every message sent by php mail takes about 30 seconds to send.  The same thing happens when I send via the PEAR SMTP package.  Takes about 30 seconds, and sends three times.

It could be a DNS issue, I had no idea how to set it up, so I guessed:
A-type: @ smsalertsonline.com 174.36.99.28
A-type: www.smsalertsonline.com 174.36.99.28
MX entry: @ smsalertsonline.com - Mailer-server: smsalertsonline.com

Could it be a problem with sendmail?  Is something not configured properly?  Exim?
0
Comment
Question by:rom109
1 Comment
 
LVL 11

Accepted Solution

by:
VanHackman earned 500 total points
ID: 34923500
I will be good to take a look over the code that you are using.

But, It's probably a matter of the SMTP server, and no of the Code itselft.

Try using PhpMailer: http://phpmailer.worxware.com/

And if you don't get a better result, ask your hosting provider about if the SMTP server of your account is getting a big load.

Kind regards,
VanHackman.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've written instructions for one router type, but this principle may be useful for others of the same brand and even other brands of router. Problem: I had an issue especially with mobile devices that refused to use DNS information supplied via…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now