In this article, we will focus on the Mailer error: The following From address failed: firstname.lastname@example.org : MAIL not accepted from server, 530,5.7.0 Authentication Required.
This is a common error that occurs while sending email through Gmail Link: https://mail.google.com/ account and while using PHPMailer Class link: https://github.com/PHPMailer/PHPMailer.
Now, let us look at the causes and solutions to this error.
What causes this error?
Let us look at the reasons for this error.
Cause 1: Incorrect SMTP Setting for Email
This error may arise due to incorrect SMTP settings.
Thus, check your SMTP settings first.
$mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'email@example.com'; // SMTP username $mail->Password = 'password'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to
Important: You have to check the SMTP and PORT settings.
$mail->Port = 587; & $mail->SMTPSecure = 'tls';
Doing this might solve the issue.
Cause 2: Less Secure App Accessed is not Enabled
Less secure apps are usually 3rd party applications that send your credentials directly to Gmail. Here, an authorization mechanism such as OAuth isn’t used. If the “Less secure app access” is disabled in Gmail, you’ll face this error.
To avoid this, you need to enable “Less secure app access” in your Gmail account settings.
Steps to enable less secure app
i) Login to your Gmail account
ii) Click on the top right Profile iconand then click on Account
iii) In the Account Window that opens up, click on the Security button on the left navigation column
iv) Scroll down and search for the option “Less secure app access”. If you have previously enabled the “2 Step Verification” option, then the “Less secure app access” will not be available. Therefore, you have to disable the “2 Step Verification” option
v) Now, scroll up to the “Signing in to Google” section. Then, click on the “2-Step Verification”button
vi) A 2-Step Verificationwindow will pop up. Here, click on the “TURN OFF” option to disable this feature
Now, go back to the previous page and you’ll see the “Less secure app access” has appeared.
vii) You can enable the “Less secure app access” option now. For this, click on “Turn on access (not recommended)”
viii) This will take you to a page called Less secure app access. Here, click on the toggle button beside “Allow less secure apps access” asshown in the image. This will enable less secure applications.
Or, click on the link given below and turn off the toggle button –
If you have followed the steps mentioned above, you can easily send and receive emails on your Gmail account. In case you are still facing the Mailer error: The following From address failed: firstname.lastname@example.org : MAIL not accepted from server,530,5.7.0 Authentication Required error, then feel free to write about it in the comment section below.