super slow PHPMailer / 123reg

Joined
12 Feb 2006
Posts
17,439
Location
Surrey
i wrote breifly about this issue before on here but looking now to finally solve it, with the help of chatgpt

i was with vidahost, then tsohost, and service was fine. once tsohost got bought out by 123reg, they did some migration thing, and perhaps coincidentally, sending emails from my website using phpmail slowed to a crawl, anything from 5 seconds to 15 seconds.

i've endured but now looking to fix this issue once and for all. chatgpt has been at my side and helping me through this, but it seems the main issue is my host, 123reg, with slow response time.

SMTP Delay (13 seconds is slow!)


  • The main delay is here:


    2025-03-13 00:21:34 CLIENT

  • 2025-03-13 00:21:47 SERVER
  • CLIENT:250 OK


  • That’s 13 seconds waiting for GoDaddy’s mail server!

so i'm wondering what to do. chatgpt suggest changing smtp provider as godaddy (i guess this is the same company as 123reg) is too slow.

my issue though is that surely the paid for service with 123reg is going to be better than a free service from the likes of gmail? and what about spam factor, will gmail smtp result in a higher rate of being marked as spam?

one thing i should note is that max we send around 60 emails a day in the busy period and this is spread out througout the day, but it's much closer to 5-10 in quieter periods (winter)
 
Last edited:
What has 123reg said about it?

This is a guess but could it be related to DNS in some way? i.e. the speed at which your web page can be authenticated to be able to use the mailserver, involving MX record setup of your domain.
 
i haven't spoke to them yet. i have a tab open to give them a call tomorrow in the day. long gone are the days of vidahost and their speedy online chat at all hours of the night!
 
Last edited:
i haven't spoke to them yet. i have a tab open to give them a call tomorrow in the day. long gone are the days of vidahost and their speedy online chat at all hours of the night!
I've called them quite a few times and they always seem fast to respond..

Sending emails from your Web site? As in a contact form?
 
with no issues of emails being marked as spam?

while i have this thread, is it better for trust by the recipients email provider to have emails sent from an address like contact@domain, or noreply@domain.
 
Do you have SSH access to a machine that the script is running from?

If so, "swaks" is a useful SMTP troubleshooting tool that will show how long each step of connecting/TLS/auth/sending takes. Pipe it through "ts" and you get absolute timestamps too:

Code:
swaks \
--show-time-lapse \
--server smtpout.secureserver.net \
--protocol SSMTPA \
--from [email protected] \
--to [email protected] \
--auth LOGIN \
--auth-user username \
--auth-password password \
| ts %H:%M:%S

You can set --protocol depending on what your SMTP relay needs:

* SMTP = no encryption, port 25, no authentication
* ESMTP = STARTTLS, port 25, no authentication
* ESMTPA = STARTTLS, port 25, with authentication
* SSMTP = TLS, port 465, no authentication
* SSMTPA = TLS, port 465, with authentication

If a server has both A/AAAA DNS records and the machine doesn't have IPv6 setup correctly, then sometimes it'll try defaulting to IPv6 and failing, then falling-back to IPv4 - try forcing IPv4 (-4) or IPv6 (-6).
 
Do you have SSH access to a machine that the script is running from?

If so, "swaks" is a useful SMTP troubleshooting tool that will show how long each step of connecting/TLS/auth/sending takes. Pipe it through "ts" and you get absolute timestamps too:

Code:
swaks \
--show-time-lapse \
--server smtpout.secureserver.net \
--protocol SSMTPA \
--from [email protected] \
--to [email protected] \
--auth LOGIN \
--auth-user username \
--auth-password password \
| ts %H:%M:%S


thanks. this is the exact code i use. how would i insert swaks into this?

PHP:
$mailCopy = new PHPMailer(TRUE);

try {
    
    //Server settings
   $mailCopy->isSMTP();
   $mailCopy->Host = 'mail.213213.co.uk';
   $mailCopy->SMTPAuth = TRUE;
   $mailCopy->SMTPSecure = 'ssl';
   $mailCopy->Username = '[email protected]';
   $mailCopy->Password = '12345';
   $mailCopy->Port = 465;   
   /* Enable SMTP debug output. */
   //$mailCopy->SMTPDebug = 2;   
  
  
    //Recipients
   $mailCopy->setFrom($your_email, $busi);
   $mailCopy->addAddress($email, $fullname);
   $mailCopy->addReplyTo($your_email, $busi);
  

  
   //Content
   $mailCopy->Subject = $fullname.', here\'s your quote';
   $mailCopy->Body = $body_quote;
   $mailCopy->IsHTML(true);

  
    $mailCopy->send();
    
    //echo '<br />Message copy has been sent';
} catch (Exception $e) {
    echo '<br />Message copy could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
}
 
swaks looks like a CLI command ... I don't think you'd want to be making a system call from PHP ;)

How is your PHP app hosted ? Do you have a local SMTP relay that you can use instead of trying to send mail from PHP ?

I have postfix setup as a smart relay. PHP posts locally ... job done. Any issues with mail servers, routing or connecting is managed by postfix
Sending mail via PHP directly is a risk as you'll surely encounter connection issues, dropped mail etc whereas a local smart relay will try to send any failed mail again after a certain amount of time
 
Back
Top Bottom