In Laravel 7, I want to send email from my application using Office365, tried email password and app password none worked.
MAIL_MAILER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME=my-email-here
MAIL_PASSWORD=my-email-password-here
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=my-email-here
MAIL_FROM_NAME="App name"
In the above code MAIL_PASSWORD is my email password not app password
this configuration gives me the following error
Failed to authenticate on SMTP server with username "support#tingsapp.com" using 2 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "451", with message "451 4.7.0 Temporary server error. Please try again later. PRX4 [MRXP264CA0044.FRAP264.PROD.OUTLOOK.COM]
". Authenticator XOAUTH2 returned Expected response code 235 but got code "535", with message "535 5.7.3 Authentication unsuccessful [MRXP264CA0044.FRAP264.PROD.OUTLOOK.COM]
In the second try I put App Password created in office.com as MAIL_PASSWORD value, but I get same error.
after changing the .env I run php artisan cache:clear and php artisan config:cache
Is there anything I missed, please
you need to put the password in double-quotes.
Replace: MAIL_PASSWORD=yourpassword
With: MAIL_PASSWORD="yourpassword"
after changing the .env just run:
php artisan cache:clear
You have to use your email instead of password on MAIL_FROM_ADDRESS like this
MAIL_MAILER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME=my-email-here
MAIL_PASSWORD=my-email-password-here
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=my-email-here
MAIL_FROM_NAME="App name"
or you can use smtp-mail.outlook.com as MAIL_HOST
MAIL_MAILER=smtp
MAIL_HOST=smtp-mail.outlook.com
MAIL_PORT=587
MAIL_USERNAME=my-email-here
MAIL_PASSWORD=my-email-password-here
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=my-email-here
MAIL_FROM_NAME="App name"
Related
I'm trying to send email using Laravel 5.6 but I got this error
Swift_TransportException Expected response code 250 but got code , with message PLAIN250 Reset OK
This is my configuration:
MAIL_DRIVER=smtp
MAIL_HOST=4403.smtp.antispamcloud.com
MAIL_PORT=587
MAIL_USERNAME=username#domain.tld
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
Any ideas? Thx
Check your gmail account: in settings, enable access for less secure apps and it will work.
I used the artisan command "php artisan make:auth" And Users authentication and registration is working fine but for some reason the App just can't send the reset passwords email.
I was able to properly configure the env file and even receive the message; "We have e-mailed your password reset link!", but the email never reaches the recipient.
This is my env file:
MAIL_DRIVER=log
MAIL_HOST=smtp.liberumratings.com
MAIL_PORT=587
MAIL_USERNAME=website#liberumratings.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=tls
I also tried the example below but a got this error:
(1/1) ErrorException
stream_socket_enable_crypto(): Peer certificate CN=*.locaweb.com.br'
did not match expected CN=smtp.liberumratings.com'
MAIL_DRIVER=smtp
MAIL_HOST=smtp.liberumratings.com
MAIL_PORT=587
MAIL_USERNAME=website#liberumratings.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=tls
All my parameters are correct and I am able to send emails using the PHPMailer on the same server on another application.
The encryption might be wrong. Are you using SSL?
Remove the tls and try agian. Also your answer can be found here
Laravel SMTP driver with TLS encryption
I have a problem with my laravel email client.
I need to send email by click button.
my code:
.env
MAIL_DRIVER=smtp
MAIL_HOST=mail.somedomain.com
MAIL_PORT=587
MAIL_USERNAME=test#somedomain.com
MAIL_PASSWORD=123456
MAIL_ENCRYPTION=null
I think it is good configuration, of course i'm using my domain :)
next in controller I have code like this:
Mail::send('home', array('firstname' => "fname"), function($message){
$message->to("testsend#somedomain.com")->subject('Welcome to the Laravel');
});
Website is open normally but email not send
In Gmail account
My account > Sign In And Security > Sign In to google, enable two step verification
http://i.prntscr.com/7c849cb520e84f02b39216f3662590bc.png
http://i.prntscr.com/cc52e9b8e7c2472496f1e2d2ec8185f8.png
Create One App and generate password
http://i.prntscr.com/b38cdca0724446d8a53b22dfa5f43ee6.png
In your .env file
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail#gmail.com
MAIL_PASSWORD=apppassword // this is created from gmail app password
MAIL_ENCRYPTION=tls
And Then run php artisan config:cache
When I try to send an e-mail through my website running Laravel 5, I get this exception:
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/answer/14257 l140sm14142372oig.11 - gsmtp
Here is my env configuration
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=example#gmail.com
MAIL_PASSWORD=example
MAIL_ENCRYPTION=tls
Code works on local and other website but not work on my new website on new hosting. I allow access from less-secure apps. What can be problem?
It's possible that G-Mail doesn't like the 3rd party application that's connecting to it.
If you are sure the credentials are correct, then visit this link to check if you need to approve the application
I am trying to send an email in laravel application.
Here is my .env file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=ehsan.sani91#gmail.com
MAIL_PASSWORD=**********
MAIL_ENCRYPTION=tls
And here is the Mail::send method:
Mail::send('email', ['name' => "EE"], function($m){
$m->to('ee#dx.com', 'Malik')->subject('Subjet of the email');
});
And here is the error:
Swift_TransportException in AbstractSmtpTransport.php line 383: Expected response code 250 but got code "530", with message "530 5.7.0 Must issue a STARTTLS command first. s16sm7748968wib.16 - gsmtp"
Any help?
Well, I got it. Infact the email was not authenticated because that email required a mobile phone authentication after login. changing to other email address that required just login credentials, it worked.
.env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=youremail#host.com
MAIL_PASSWORD=yourpassword
MAIL_ENCRYPTION=tls
GMail SMTP requires encryption. Try changing setting as following.
MAIL_PORT=465
MAIL_ENCRYPTION=ssl
I made the following mistake:
I did not actually include the
'encryption' => env('MAIL_ENCRYPTION'),
to the array return in mail.php. I did include my host, port, username and password in the mail.php but not the encryption method (the encryption method I only included in the .env file), so trying out these mentioned solutions did bring a change in the error messages outcome, created a bigger confusion, but none solved the problem. Hope this helps someone!