Mail is not sent every time by swiftmailer using office365 - php

Smtp details which we use are correct, for host smtp.office365.com mail is not sent every time.
Sometimes this error is generated,
Fatal error: Uncaught Swift_TransportException: Failed to authenticate on SMTP server with username "XXX" using 2 possible authenticators in vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php on line 181
Observed behaviour
Sometimes with the same details, emails are sent.
Expected behaviour
It should send an email every time.
Can anyone please tell me what should I do?

Is the login credentials you used correct and the.env file configured correctly? Here are two links that might be useful to you.
PHP Fatal error: 'Swift_TransportException' with message 'Failed to authenticate on SMTP server
Failed to authenticate on SMTP server error using gmail

Related

How do I get fix the SMTP Error: data not accepted error?

I am trying to send mass e-mails via PHPList software with the Direct Mail service in Alibaba Cloud, but I am getting the error below.
Error sending email to email#gmail.com SMTP Error: data not accepted.SMTP server error: DATA command failed Detail: Invalid rcptto [#sm070102] at DATA State(Connection IP address:111.111.11.11) ANTISPAM_BAT[01201311R166c, ay35sg011193009126]: invaddr reject SMTP code: 559
What should I do to fix this problem?

Laravel Failed to authenticate on SMTP server

Failed to authenticate on SMTP server with username "xxxxx#xxxx.org" using 2 possible authenticators
I have two Mail (send mail controller) functions on laravel. One works fine with the credentials one throws this error? Not sure what is causing it.

Can PHPMailer determine the precise reason for SMTP failure?

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 am trying to send email through smtp but an error is showing

I am trying to send email through SMTP but an error is showing
2015-08-13 07:03:50 SMTP ERROR: Failed to connect to server: (0) The following From address failed: bijay009009#gmail.com Mailer Error: The following From address failed: bijay009009#gmail.com
There can be few reasons for the error:
1. The email server is unreachable. Either the server is down or email service is not running or your fiewall is blocking the access.
2. The user does not have permission to connect to the server to send email using SMTP.

550 The address is not valid

I have a problem in CodeIgniter, sending a validation email:
A PHP Error was encountered
Severity: Warning
Message: mail() [function.mail]: SMTP server response: 550 The address
is not valid.
Filename: libraries/Email.php
Line Number: 1553
Usually this error means your mail server requires SMTP authentication to send emails. You may have two options, one is to change to another SMTP server that does not require authentication.
The other option will be to put the credentials in your config. Please check this page, and try with the smtp_user/smtp_pass settings.
If you post your config settings and the use case, I'll be able to provide you with more details.
To be clear, "550 The address is not valid." means that the mail server cannot accept your email because it cannot find the mailbox "admin#cam-corp.com". Are you sure that you have configured your mailserver properly?

Categories