I'm new to php/laravel tech.
My .env file contains following configuration[1];
When I try to reset the password, It says, password link has been sent, But I haven't received any emails.
What I'm doing wrong here?
p.s: I'm providing null for MAIL_ENCRYPTION/ MAIL_USERNAME, due to one issue I faced.(Swift_TransportException Failed to authenticate on SMTP server with username "abc#abc.com" using 2 possible authenticators)
[1]
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=2525
MAIL_ENCRYPTION=null
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS=abc#abc.com
MAIL_FROM_NAME="Administrator"
Related
I am trying to send an email to a guest in laravel.
Below is my code:
Mail::to($requestor->email)->send(new ApprovedNotification(auth()->user()->name));
The question is how can I send the email through proxy? Does it requires any server side configuration or I can just set it in laravel? The code is running fine when I am using my home network but when using my company server, the SMTP can't be sent out. ( The weird thing is the Jetstream team invitation email can be sent, but the customized emails cant)
Below is my email configuration:
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=xxxxxx#gmail.com
MAIL_PASSWORD=xxxxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=xxxxxx#gmail.com
MAIL_FROM_NAME="${APP_NAME}"
Thanks in advance!
If you are using Gmail then you must generate App password.
https://support.google.com/accounts/answer/185833/sign-in-with-app-passwords?hl=en
then your mail configuration look like this
MAIL_MAILER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=587
MAIL_USERNAME=xxxxxxxxxx#gmail.com
MAIL_PASSWORD=xxxxxxxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=xxxxxxxxx#gmail.com
MAIL_FROM_NAME="${APP_NAME}"
Can't send email from Laravel platform. Tried with different another emails (gmail, mailgun) and they work properly but it seems that can't make it work with the one our customer wants to use:
MAIL_DRIVER=smtp
MAIL_HOST=xxx.xxx.xx
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
We got this error:
Swift_TransportException: Connection could not be established with
host [php_network_getaddresses: getaddrinfo failed: Name or service
not known #0] in
.../vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:269
I can connect with telnet from the server so it apparently everything's ok. But I find very weird this configuration. Do I need to check something else in Laravel to make it work?
EDIT 1:
Tried with this configuration too:
MAIL_DRIVER=smtp
MAIL_HOST=xxx.xxx.xx
MAIL_PORT=587
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=TLS
Keep getting the same error,tho
Uhm, for some reason (I don't really know why) .env file does not apply changes even with config:clear or config:cache...so everytime I changed something there I always get the same error.
The only solution was to do a sudo reboot and then it gets the new configuration.
this can be the case if a proxy is used on the Internet. check without using a proxy
I'm trying to use Laravel's auth package, and I'm getting various errors when trying to use its "send password reset link" option. I'm using MAMP as the server. My .env by default looks like this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
I keep getting Swift_TransportException errors when I try to send mail.
Am I supposed to connect a Gmail address I own, using my email and password, essentially telling Laravel to use Gmail as the mail server? Isn't this a security risk since my password would be out in the open?
As an alternative, can/should I add a mail server to MAMP and use its credentials? Again, isn't that a security risk?
This configuration will save emails to log file:
MAIL_DRIVER=log
MAIL_HOST=mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=tls
If you register in Sendgrid, you will be able to use their smtp server.
This configuration will use Sendgrid as smtp Server:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=your_user_name_from_sendgrid
MAIL_PASSWORD=your_password_from_password
MAIL_ENCRYPTION=tls
I'm working on a laravel project (maintenance of an existing project).
The reset password was not working.. I fixed the issue by changing the .env file on my localhost.
It was
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
I changed it to
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=email#mailtrap.io
MAIL_PASSWORD=the password
MAIL_ENCRYPTION=null
It works fine on my localhost.. When I change the .env.example on bitbucket it still doesn't work and gives me the same error
Swift_TransportException in AuthHandler.php line 181:
Failed to authenticate on SMTP server with username "noreply#igpastpapers.com" using 2 possible authenticators
Any ideas?
Make sure you change your .env file in your production code, NOT your .env.example file. The .env.example is only setup so you can see the build of your .env file wherever you keep your version control code (Git, etc), without actually having the secure data shown. Check this link out:
Environment Configuration
I tried loading my page I created using laravel and after I hit the registration button and I got the above error message, please what must I do?
Mailtrap is an email testing service for testing. It will catch all the mail sent from your application, so you can test mails without sending it to client. In order to use it, you have to follow these steps:
First you have to create an account on Mailtrap. Then go to your dashboard and note your credentials. It may be something like:
Username: 05921688469af01
Password: 2efe39296ae5b7f
Then paste this values in your .env file of your Laravel application (the username must be pasted in MAIL_USERNAME and the password must be pasted in MAIL_PASSWORD).
It might look like this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=05921688469af01
MAIL_PASSWORD=2efe39296ae5b7f
MAIL_ENCRYPTION=null
Then try again and it will work! You can go to your Mailtrap dashboard to see the result.
Check below settings if you are using in your .env file of root folder of project.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.yourdomainname.com
MAIL_PORT=2525
MAIL_USERNAME=email#yourdomainname.com
MAIL_PASSWORD= ********
MAIL_ENCRYPTION=null
Or
if you are using Gmail for sending a email then do following settings.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=******#gmail.com
MAIL_PASSWORD=*****
MAIL_ENCRYPTION=ssl
Try to use another SMTP port (2525, 465 or 25) https://mailtrap.io/faq#faq14
And also make sure to set your credentials which you got from mailtrap in .envfile
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=your mailtrap username
MAIL_PASSWORD=your mailtrap password
MAIL_ENCRYPTION=null