Failed to authenticate password. Error: 534-5.7.14 Please log in via your web browser and then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 wv1sm5867206pab.37 - gsmtp
function index() {
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'gauravkwt#gmail.com',
'smtp_pass' => '92135108845129',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('gauravkwt#gmail.com', 'Gaurav kwatra');
$this->email->to('gaurav.kawatra#ymail.com');
$this->email->subject('This is an email test');
$this->email->message('Emial Testing');
//$this->email->initialize($config);
if($this->email->send())
{
echo 'Your email sent...!!!! ';
}
else
{
show_error($this->email->print_debugger());
}
}
//end of code
I use above code to send mail from codeigniter....I have an error...Failed to authenticate. Password is correct.
You would need to go to your account settings https://www.google.com/settings/security and you would need to enable Access for less secure apps which helps to use the google smtp for clients.
Please have a look here too
If it still doesn't work even after enabling less secure apps - you should login to your security area within your Google account and see if your device has been blocked. Google blocked my server so I then went to https://accounts.google.com/b/0/displayunlockcaptcha and it now allows me to send. Nothing to do with the username or password but Google blocking the device access.
I have got the same problem and the solution I found by unblocking the google captcha. Google blocked my server IP sending email using their SMTP. So I had to unblock it.
To unblock the google captche:
Open the link https://accounts.google.com/DisplayUnlockCaptcha.
Enter your username and password to sign in to your gmail account that you have used for the SMTP configuration.
You will get the button on google like the image bellow.
Then you need to allow access to your google account by clicking the continue button.
Note: You might get blocked again and anytime if you make some spam and your receiver email addresses are not exist.
So if anyone knows how to make it unblock permanently without by any google setting or something, it would be really appreciated.
One of the reason can be the cpanel settings. Please try:
Login to CPanel
Tweak Settings > All>
"Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)
And select "off"
Although it was a question five years ago, today I encountered the same situation and found the correct answer as a supplement.
All CI settings are correct, the only problem lies in Google ’s security settings, go to
https://myaccount.google.com/security
And set Sign in using App Passwords, which can find options, select mail, and choose other in the options of the device, enter the name at will, such as PHP / CI, and then Google will generate a password for you to use.
Please replace the password you entered in the CI email with this password, cheers.
Related
I've already confirmed my custom domain and I'm always get this error:
554 Free accounts are for test purposes only. Please upgrade or add the address to authorized recipients in Account Settings.
The following SMTP error was encountered: 554 Free accounts are for test purposes only. Please upgrade or add the address to authorized recipients in Account Settings.
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
Config:
$this->email->initialize(array(
'mailtype' => 'html',
'protocol' => 'smtp',
'smtp_timeout' => 30,
'smtp_host' => 'ssl://smtp.mailgun.org',
'smtp_port' => '465',
'smtp_user' => '***',
'smtp_pass' => '***'
));
What could be wrong? Try in both localhost / server - and the same error is shown. This is not credentials problem either cause I can see the logs on Mailgun dashboard.
Pretty sure that they changed their policy recently: "Without a credit card you are restricted to authorized recipients only."
You just need add CC to make it work. - They should put this message on the top of their registration page!!!
It's still free for first 10,000 though.
A bit annoying - but the solution is to add credit card to the account.
credit card need not be added. the error message clearly shows that no authorized recipients have been added. Mailgun allows 10,000 free emails for 30days, which can be used for testing (even from a local host) provided authorized email ids are added (upto 5). this can be done on the dashboard page. instructions given in the documentation. I have been testing out my mailer using a localhost (WAMP server) on 3 authorized email recipients that i've added. credit card is to be added only when the 10000 email quota is exceeded.
When I try to send an e-mail through my website running Laravel 4, I get this exception:
{"error":{"type":"Swift_TransportException","message":"Expected response code 250 but got code \"535\", with message \"535-5.7.8 Username and Password not accepted. Learn more at\r\n535 5.7.8 http:\/\/support.google.com\/mail\/bin\/answer.py?answer=14257 y70sm14744455qgd.3 - gsmtp\r\n\"","file":"\/var\/www\/vendor\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/AbstractSmtpTransport.php","line":386}}
Here is my mail config:
return array(
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'from' => array('address' => 'mymail#gmail.com', 'name' => 'myname'),
'encryption' => 'ssl',
'username' => 'mymail#gmail.com',
'password' => 'lol',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
I've tried the disable link i've found by googling this issue except it didn't make a difference.
Is there a way to tell Google "stop blocking this IP, it's me" ?
I tried the same thing and got the same error. So i personally checked my gmail account and i had a message from Gmail itself letting me know that they'd blocked an access attempt to my email account.
They showed an option to disable this security setting by visiting https://www.google.com/settings/security/lesssecureapps.
Things will actually be more straight forward if you visit that link already logged in into your Gmail account.
Warning
As #kodfire stated:
On May 30, 2022, this setting will no longer be available.
support.google.com/accounts?p=less-secure-apps&hl=en
Go to this link and disable unlock Captcha
https://accounts.google.com/b/0/DisplayUnlockCaptcha
Try this:
Change port to 587
Goto gmail setting https://www.google.com/settings/security/lesssecureapps
and active it.
https://www.google.com/settings/security/lesssecureapps and active it.
https://accounts.google.com/b/0/DisplayUnlockCaptcha and active it.
'port' => env('MAIL_PORT', 587), <br>
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
I had lot of issues finding answer for this. Then after doing lot of trial and error i have found an solution to this. Most of the solution above worked for other but it help me upto 50%.
So, This is how it worked for me (100%):
Activate 2 step Verification in google
Now you will be able to create app. Open it.
Create new app (other app) and give your app name.
Now generate password.
Next in laravel, Goto .env file and change
MAIL_USERNAME= 'App Name you created'
MAIL_PASSWORD= 'Generated Password for that app'
This should be able to send emails from your gmail account.
Please leave a comment if it doesn't works for you.
Did you activate 2-step google authentification? If so, you need to define a new "application-specific password" password: http://www.google.com/landing/2step/.
Remove the #gmail.com from username, already you mentioned smtp. So no need #gmail.com on your username. I'm 100% sure it is your problem, because I had that problem.
I'm trying to send an email using PHP Pear. It works when I send email using Gmail with this settings:
$smtp = Mail::factory('smtp', array(
'host' => 'ssl://smtp.gmail.com',
'port' => '465',
'auth' => true,
'username' => 'username#gmail.com',
'password' => 'password!2016'
));
But before I make this work, I have to "allow less secure apps" to access my account, which you can read here on how to do it.
I tried to use an Outlook account with this settings:
$smtp = Mail::factory('smtp', array(
'host' => 'tls://smtp.office365.com',
'port' => '587',
'auth' => true,
'username' => 'email#domain.org',
'password' => 'greatPasswordComesWithGreatResponsibilities'
));
but I get this error:
Failed to connect to ssl://smtp.office365.com:587 [SMTP: Failed to connect socket: fsockopen(): unable to connect to ssl://smtp.office365.com:587 (Unknown error) (code: -1, response: )]
I checked the official article by Microsoft regarding their SMTP settings. So I thought I have the right settings, but it's not working.
Am I missing something? Why do I get this error? Is there a setting I have to configure in my outlook account, like with the Gmail, before a third party app be allowed to send email?
This may not help but the title of your post just said Outlook account but the link and smtp settings refer to Office365 for Business accounts. I can't shed any light on the business account but if you actually have a personal Outlook.com account the settings are different. And, there is an option on the account you must change to enable pop/smtp access as you did with gmail.
The official Microsoft article is:
https://support.office.com/en-us/article/Add-your-Outlook-com-account-to-another-mail-app-73f3b178-0009-41ae-aab1-87b80fa94970?ui=en-US&rs=en-US&ad=US&fromAR=1
But, the summary is the smtp server is smtp-mail.outlook.com and to enable pop/smtp in your Outlook account look for Options > Managing your account > Connect devices and apps with POP.
Update:
If you are actually using business account, you should check this post which claims to have it working: https://stackoverflow.com/a/26004690/2891120
The key item in his code is he doesn't have "tls://" in front of the host name. I have a consumer outlook account and get a similar socket failure to you with tls:// prefix. If I remove that prefix I get much farther (set debug=true in factory) but fail later with an auth failure. Using 5.2.16 PHPMailer instead I successfully send mail but the headers leave me worried about spam rejection rates (no DKIM, SPF was softfail for my AWS entity, warning about -f, and others). And, the email did end up in the junk folder of my other test recipient #outlook.com. But I digress.
I'm not sure if the issue with with Postfix, MediaWiki, LAMP or what. Basically I configured an extension for MediaWiki for AccountRequest and it's supposed to send an email out to the user that created to give them login information. Emails aren't sent out. I figured it might be something to do with settings in localsettings.php but when I add the $wgSMTP array listed below but with my info I start getting [3b2f8024] 2015-11-24 20:19:31: Fatal exception of type "MWException" showing up on mediawiki.
$wgSMTP = array(
'host' => "mail.example.com", // could also be an IP address. Where the SMTP server is located
'IDHost' => "example.com", // Generally this will be the domain name of your website (aka mywiki.org)
'port' => 25, // Port to use when connecting to the SMTP server
'auth' => true, // Should we use SMTP authentication (true or false)
'username' => "my_user_name", // Username to use for SMTP authentication (if being used)
'password' => "my_password" // Password to use for SMTP authentication (if being used)
);
If I leave the localsettings.php settings as enabled and all that it will act like it works but users never get the email.
$wgEnableEmail = true;
$wgEnableUserEmail = true; # UPO
$wgEmergencyContact = "apache#10.00.000.000";
$wgPasswordSender = "apache#10.00.000.000";
$wgEnotifUserTalk = true; # UPO
$wgEnotifWatchlist = false; # UPO
$wgEmailAuthentication = true;
Wondering of a good workaround for this or if someone can point me in the right direction to get this fixed that would be awesome. I've spent hours googling without any results. If my question isn't clear or you need more information please just ask.
Check that the SMTP server is actually reachable. With your $wgSMTP settings, do:
telnet mail.example.com 25
and see if you can connect. If not, either there is no SMTP server running there or there is a firewall. Double check the SMTP host and port, check instructions on how to open firewall in your distribution.
On my localhost (Linux Mint OS) Swiftmailer is working fine with the following code, but whenever I move it up to my server is just hangs at the send function and then gives me an internal server error.
I currently have my email setup through Google Apps, so maybe SMTP will not work for this situation? If thats the case, how do you suggest I change this from SMTP.
Also, whenever I send an email like this, it is showing up with a from address of the one in the username area. I want it to show up with the from address in the "setFrom" function.
//Include the swiftmailer class
require_once 'comm/swiftmailer/swift_required.php';
//Create a message
//Pass it as a parameter when you create the message
$message = Swift_Message::newInstance();
$message->setSubject('My Subject');
$message->setFrom(array('noreply#domain.com' => 'No Reply'));
$message->setTo(array('me#domain.com' => 'Me'));
$message->setBody($emailContent, 'text/html');
//Create transport class and email the message
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')->setUsername('useracctname')->setPassword('password');
$mailer = Swift_Mailer::newInstance($transport);
$result = $mailer->send($message);
Thanks a lot for any help!
This might be a port problem on the server. Port 465 could be closed to prevent spamming. It could also be that the server's version of PHP lacks SSL support.
I am wondering though, could it be that I am not using the local mail server so it wont allow SMTP?
If you address gmail as explicitly as you do, it's very unlikely you're using another transport type or a different server.
Also, what about using one of the other transport types?
I think SMTP is your only option to get it running with Gmail. It could, however, be that your server is providing a mail() based service (obviously with a different sender address than GMail though). In that case, you may be able to use Swiftmailer's mail transport.
I had the same problem : I was able to send gmail email in local (after updating that configuration : https://www.google.com/settings/security/lesssecureapps ) but not in production.
To fix my problem I've logged to my gmail account with my production ip / from my production server and answer the gmail security question.
One of the solution to log to your gmail account with your production ip, is to
open an ssh tunnel (ssh -2NfCT -D 5000 yoursshuser#yourdomain.org)
configure you browser to use that proxy (eg Firefox :to Preferences > Advanced > Network > Settings > Manual proxy configuration > SOCKS Hosts: localhost / Post: 5000 / SOCKS v5 )
log to you gmail account as usual
The error outputed by Symfony was :
app.ERROR: Exception occurred while flushing email queue: Failed to authenticate on SMTP server with username "joe.doe" using 1 possible authenticators [] []
well, here is the solution.
if you are sending SMTP mail you should create email account at the server then use this email info at your code.
the server will not send the email if you don't have valid email account to send using it
when you use "from".
this should be a true correct email account a fake one.
the only possible reason to send using fake account is using mail() function.