We've been using PHPMailer to send SMTP mail through Mailgun for years now.
We've recently upgraded our logging, and we've noticed that some mail just doesn't send.
Here is the SMTP log we're seeing:
Connection: opening to smtp.mailgun.org:587, timeout=300, options=array()
Connection: opened
SERVER -> CLIENT: SMTP
NOTICE: EOF caught while checking if connected
Connection: closed
SMTP Error: Could not connect to SMTP host.
SMTP Error: Could not connect to SMTP host.
This particular email was attempted to be sent with the Start TLS method via port 587.
How come most of our mail gets through but now and then we get this error?
Does anyone know what "EOF caught while checking if connected" could be caused by?
We're using the latest stable build of PHPMailer v6.1.5.
Thanks!
Thanks to advice from #Syncro and #Álvaro González and Mailgun themselves, I ended up building in a retry mechanism that attempts to send mail 3 times before failing.
So far this seems to be working, I will report back if anything changes!
Related
I'm facing below problem:
rcpt to: toxxxx#smtphost.com 454 4.7.1 toxxxx#smtphost.com
I'm facing below problem: telnet 10.5.2.28 25 Trying 11.1.2.21... Connected to 11.1.2.21. Escape character is... 220 smtp04.smtphost.com ESMTP Postfix HELO 171.21.1.21(application server) 250 smtp04.smtphost.com mail from: fromxxx#smtphost.com 250 2.1.0 Ok rcpt to: toxxxx#smtphost.com 454 4.7.1 <toxxxx#smtphost.com>: Relay access denied
: Relay access denied
The SMTP server that you are connecting to is not the MX for the recipient that you are trying to send the message to. So, to send the message, the SMTP server that you are connecting to would have to relay the message. The error that you are getting Relay access denied indicates that the SMTP server will not relay the message.
Did you authenticate with the SMTP server that you are connecting to? If not, then it's not surprising that you are seeing this error message, as otherwise this would be an open relay, and would probably quickly be abused by spammers.
I'm currently writing a tool that helps users configure an SMTP send, and am using PHPMailer to achieve this. Presently I notify users if the SMTP operation was not successful, and I'd like to make this more specific.
In the source code, it says:
// The reason for failing to send will be in $mail->ErrorInfo
However, the contents of this property are not very specific. For example, for both a failed auth and an unreachable server, I get the identical error:
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
However, if I dig into the SMTP logs using PHPMailer's debug level 2, I get more useful information. For a failed auth:
2018-01-31 19:37:12 SERVER -> CLIENT: 535 Incorrect authentication data
2018-01-31 19:37:12 SMTP ERROR: Password command failed: 535 Incorrect authentication data
2018-01-31 19:37:12 SMTP Error: Could not authenticate.
For an unreachable server:
2018-01-31 21:12:34 SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
So, it looks like this information is available, but it might vary between different mail server types. Is there any parsing of this in PHPMailer? I'd like reliable reason codes I can test, rather than searching for strings in logs that might not match for every server.
I expect there are other failure types as well, such as a badly configured certificate.
I have a Gsuite account. I setup a rule to allow SMTP relay through gmail servers, whitelisting my IP. Also, the FROM address is with my registered domain at Gsuite. And all my MX records point to google.
When trying to send a msg, the logs show that gmail accepts the connection, but in turn it passes is back to my local SMTP server.
Tried PHP PEAR mail & PHPMailer, same issue.
The logs start like this:
Connection: opening to smtp-relay.gmail.com:25, timeout=300, options=array ()
Connection: opened
SERVER -> CLIENT: 220-mylocalhosting.com ESMTP Exim 4.89 #1 Wed, 17 May 2017 23:44:41 -0400 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
From there on, I can send emails if using authentication from my own system.
In short, I specify gmail relay server, but my messages end up going out from my local mail server. And I can't understand why.
UPDATE: If the PHP script runs as 'root', gmail takes the message and processes it as expected:
Connection: opening to smtp-relay.gmail.com:25, timeout=300, options=array ()
Connection: opened
SERVER -> CLIENT: 220 smtp-relay.gmail.com ESMTP 137sm1646549itk.4 - gsmtp
But I can't make it do the same as a regular user.
Any assistance would be appreciated.
Found the problem: It's a setting in WHM SMTP Restrictions. WHM Manual
Hi guis I have been migrating an application to new server, is an Ubuntu server but on the new server I have some problem to send emails using Cakephp 2.0.
If the host on cake mail config is localhost I have the following error:
SMTP Error: 530 5.7.0 Must issue a STARTTLS command first
Search on the internet the solutions may be is config SMTP ssl://mydomain.com.br on php.ini or using ssl host like this ssl://mydomain.com.br on cake mail config. On the first option nothing change, error persist and with host ssl on cake mail config I have the following error:
Unable to connect to SMTP server.
I make a simples test using only php mail() function and the email is been sent.
On this server I config postfix and dovecot may be this can be the problem?
you can use 'PHPMailer'.
it's simple and easy.
https://github.com/PHPMailer/PHPMailer
my wordpress site email goes to Spam with php function,some site offer me using wp-mail-smtp plugin will repair my problem, but it doesn't help me!
when I use php mail() function my emails goes to spam
and when i use SMTP, i have an error like this: SMTP -> ERROR: Failed to connect to server: Connection timed out (110)
i use this settings for smtp (in wp-mail-smtp plugin):
From Email: noreply#mydoamin.com
SMTP host: smtp.gmail.com
SMTP port: 465
Encryption: Use SSL encryption
Authentication: Yes: Use SMTP authentication
Username: myEmail#gmail.com
Password: mypassword
this settings give me an error!
note: i use captcha code and my server tell me port 465 is Open!
how can I send email in my wordpress site ?
A connection timed out means that the connection isn't going through. This could be your host, since I just checked your settings - they look OK!
I would look into contacting your host with this. For all I know, that's all you can do, unless you are going to use a 3rd party mail API.
A connection timeout means your host is dropping your outbound request to Gmail. You'll need to send your Gmail out on the HTTPS port using a WordPress plugin called Postman SMTP.