I recently configured My domain to Gsuite email. I using it for my laravel application.
The below error occur when using Gsuite email but it is working fine with other gmail accounts and other email servers. Please help with me to find this issue.
Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials v4sm27577447pgf.20 - gsmtp "
My email Configuration
return array(
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
'from' => array('address' => '{{Mydomain email}}', 'name' => '{{myname}}'),
'encryption' => 'tls',
'username' => '{{mydomain email}}',
'password' => '{{app password}}',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
i was also facing this problem
i used following credentials
'driver' => 'sendmail',
'host' => 'mail.gmail.com',
and it worked
Related
I get error when trying send mail with Yii::$app->mailer->compose() function. This error appears when trying to connect smtp server, so I provide error message and mailer YII2 configuration
Expected response code 250 but got code "535", with message "535-5.7.8
Username and Password not accepted.
Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials 59sm3639427wrc.23 -> gsmtp"
Here is params from config/common.php file:
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'port' => '587',
'encryption' => 'tls',
'username' => 'myemailbox#yahoo.com',
'password' => 'myemailpass',
'host' => 'smtp.mail.yahoo.com',
],
],
I already enabled "Allow apps that use less secure sign in" function in Yahoo account settings. Trying "app password" option but got the same result.
Before using yahoo smtp I tried it the same way with google smtp. Error message still refers to the https://support.google.com page. Is it possible Apache cached login and pass to smtp server?
Of course I checked google support page and followed instructions included https://accounts.google.com/DisplayUnlockCaptcha page.
try changing port
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'port' => '465',
'encryption' => 'tls',
'username' => 'myemailbox#yahoo.com',
'password' => 'myemailpass',
'host' => 'smtp.mail.yahoo.com',
],
],
I resolved this case, but didn`t detect what exactly was the cause. Maybe there was some sort of cache of config error.
So I put this direct setting right before compose function:
\Yii::$app->mailer->setTransport([
'class' => 'Swift_SmtpTransport',
'port' => '587',
'encryption' => 'tls',
'username' => 'myemailbox#yahoo.com',
'password' => 'myemailpass',
'host' => 'smtp.mail.yahoo.com',
]);
And it started to work.
I configured my website to send mails through gmail's SMTP. My websiite is running in laravel - 4 framework. Below is the code in config>>mail.php
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
'from' => array('address' => null, 'name' => null),
'encryption' => 'tls',
'username' => 'xxx#somedomain.com',
'password' => 'xxxxxx',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false
And this is a sample of code, on how I send mail,
$from = 'sender#somedomain.com';
$mail = Mail::send('mailer_template', ['any_data' => $data], function ($msg) use ($from, $from_name, $to_email, $subject, $attach) {
$msg->from($from,$from_name);
$msg->to($to_email);
$msg->subject($subject);
$msg->attach($attach);
});
When I send a mail, the mail is being sent. But it is sent from - 'xxx#somedomain.com'. I want it to be sent through the email in $from variabble. And the from address will change at different places. I am not sure how to configure this. Any help would be appreciated.
Have you visited this URL yet? If not, go there and follow the instructions then try to sign in again with your application on the production server.
https://accounts.google.com/displayunlockcaptcha
Try to solve it this way. Keep it mind.
Here password is not mandatory.
Keep blank for encryption field.
use smtp-relay.gmail.com.
return array(
'driver' => 'smtp',
'host' => 'smtp-relay.gmail.com',
'port' => 25, //25, 465 or 587
'from' => array('address' => 'xxx#gmail.com', 'name' => 'myname'),
'encryption' => '',
'username' => 'xxx#gmail.com',
'password' => '',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
This doesn't seems feasible as SMTP(gmail) only use one from email (whose detials are added to config/env).In your case whenever you send a mail, the mail is being sent from - 'xxx#somedomain.com'.
I'm trying to send email using Laravel. I configured mail.php with details of gmail server and used my personal gmail account credentials. It worked fine.
Then i tried to configure mail.php with the Secure SSl/TLS settings that my mail provider has provided me.
I changed host, port, username and password. I also changed encryption to ssl.
But i'm not able to send email. After some loading time, it just shows a blank page. No Error.
here's my config file(have removed doc-blocks):
<?php
return array(
'driver' => 'smtp',
'host' => 'myServerHostAddress',
'port' => portno,
'from' => array('address' => 'registration#gambiadept.com', 'name' => 'Gambia Dept'),
'encryption' => 'ssl',
'username' => 'usernameFromMyServiceProvider',
'password' => 'myPassword',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
Start working with Laravel 4.2 I tried to send email using Gmail STMP server. Below is my app/config/mail.php.
return array(
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'from' => array('address' => 'sample_address#gmail.com', 'name' => 'Sample'),
'encryption' => 'tls',
'username' => 'sample_address#gmail.com',
'password' => 'sample password',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
Below is my php code.
<!-- app/views/emails/welcome.php -->
Mail::send('emails.welcome', 'Laravel Admin', function($msg) {
$msg->from('sample_address#gmail.com', 'Laravel Admin');
$msg->to('sample_receiver#gmail.com');
});
But it does not work. I have already configured my XAMPP php.ini on my MAC OSX. It only works when sending a normal PHP mail, not SMTP. The error message that I've got from Laravel on the view page is 'Error in exception handler'. I would like to see more error information but I don't know how to get more info. What is wrong with my code? What else do I need to do or configure? Thank you!
you can put your email and name in Input
Input::merge(array('email'=>'sample_receiver#gmail.com','name'=>'sample_name'));
Mail::send('emails.welcome', 'Laravel Admin', function($msg) {
$msg->from('sample_address#gmail.com', 'Laravel Admin');
$msg->to(Input::get('email'), Input::get('name'))->subject('You have');
});
also change 'encryption'
return array(
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'from' => array('address' => 'sample_address#gmail.com', 'name' => 'Sample'),
'encryption' => 'ssl',
'username' => 'sample_address#gmail.com',
'password' => 'sample password',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
You should change 'encryption' for ssl and in your gmail must be enabled IMAP access in config
When you are having problems with sending mails via gmail, try this. It worked for me.
Login with your gmail account and then go to:
https://accounts.google.com/b/0/DisplayUnlockCaptcha
and click continue. Then, you have few minutes to send your mail with your code.
After this, Google will allow sign in to that account from the new source.
Hi I just uploaded a site and am getting this error with the mail service.
Connection could not be established with host smtp.gmail.com [Connection refused #111]
This are my settings in my mail.php file.
return array(
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
'from' => array('address' => 'info#thesite.com', 'name' => 'Company Name'),
'encryption' => 'tls',
'username' => '*******',
'password' => '********',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
This works perfectly locally on my system but when i upload it live, it gives me errors, please help am at the verge of delivering a project, thanks!
I also faced same problem. As for me I had changed my SMPT configuring to port 25 (with SSL) and it's was fine.
I got my solution from google, you can see at here.
Try googlemail server with ssl encryption
return array(
'driver' => 'smtp',
'host' => 'smtp.googlemail.com',
'port' => 465,
'from' => array('address' => 'info#thesite.com', 'name' => 'Company Name'),
'encryption' => 'ssl',
'username' => '*******',
'password' => '********',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
Found the answer to the problem, was from my web host service providers, i use shared host so i had to call them to configure my account with them to be able to send out email, hope this helps anyone who has such problems like me in the future and this is a proper smtp configuration for gmail.
return array(
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'from' => array('address' => 'info#thesite.com', 'name' => 'Company Name'),
'encryption' => 'ssl',
'username' => '*******',
'password' => '********',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
Try changing these.
'driver' => 'mail',
'port' => 587,
'encryption' => 'ssl',
This configuration works for me in GoDaddy server.
be sure you google authentication settings are enabled:
https://www.google.com/settings/security/lesssecureapps
change driver smtp to sendmail.it worked for me
MAIL_DRIVER=sendmail