I am developping a complex website but when I try to deploy it I got an error whenever the website needs to send an email (for the email validation system, built-in with Laravel). The error I got is:
[ErrorException (E_NOTICE)] Undefined offset: 3
The exception seems to be thrown from /vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php.
The only changes I made to config/mail.php is to allow self-signed certificates for ssl. My .env file contains these lines:
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=myusername //match in real file
MAIL_PASSWORD=mypassword //match in real file
MAIL_FROM_ADDRESS=from#mydomain.stackoverflow
MAIL_FROM_NAME=MyAppName
MAIL_ENCRYPTION=tls
My mail server is on the same server (as you could guess with MAIL_HOST=localhost) and is running postfix with Dovecot. I'm also using a webmail app (roundcube) to use my mail server and it works fine (except for OpenDKIM which doesn't sign outcoming mails).
Do you have any idea where my problem can come from?
EDIT: It works with Mailtrap.io so the problems should come fromp the configuration but I don't know if it comes from my Postfix config or from my Laravel config
EDIT2: I still don't understand why but removing credentials works fine. It works with credentials but only if I remove the MAIL_ENCRYPTION option (setting it to null). So here is the working config I have:
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=587
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS=from#mydomain.stackoverflow
MAIL_FROM_NAME=MyAppName
MAIL_ENCRYPTION=tls
Related
I'm in the middle of deploying my project, and the last part is getting the "forgotten password" system to work. Currently, without any mail configuration, I get the error
Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required "
I have bought my domain through namecheap.com and hosting on digitalocean.com.
My .env mail config currently looks like this
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
, which obviously isn't supposed to work.
Where do I go to get a mail username and password? Thanks.
I ended up going with mailgun's free option for now. It seems to work fine so far!
I'm using sendgrid for sending mails in Laravel in my .env file I have this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_ENCRYPTION=tls
MAIL_USERNAME=my-api-key-username
MAIL_PASSWORD=my-api-key-password
MAIL_FROM_NAME="Company"
MAIL_FROM_ADDRESS=info#mail.nl
However I get this response:
Connection could not be established with host smtp.sendgrid.net [Operation timed out #60]
What am I doing wrong here ?
I have followed the docs but this is not working!
https://sendgrid.com/docs/API_Reference/SMTP_API/integrating_with_the_smtp_api.html
Please help me out.
I was similarly having trouble.
As you noted, you need this in your .env:
MAIL_MAILER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=apikey
MAIL_PASSWORD=SG.xxxxxxxxxxxxxxxxxxxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
Make sure you're usign the correct .env for whatever environment you're testing (local, staging, production).
Check that you've verified your domain DNS: https://app.sendgrid.com/settings/sender_auth
Also if you've recently created the SendGrid account, I think you're required to click the confirmation email to prove that you own the email address (before sending will work).
See Laravel docs: https://laravel.com/docs/7.x/mail
My Laravel Apps cannot send email using another shared hosting configuration.
I'm developing laravel app (Laravel 5.7), one of my apps function is to send email after register new account. I have deployed my apps to my VPS and I have account on a shared hosting. I used my shared hosting configuration for sending email and I have added the config to my .env file, like
MAIL_DRIVER=smtp
MAIL_HOST=mail.embara.id
MAIL_PORT=465
MAIL_USERNAME="username"
MAIL_PASSWORD="password"
MAIL_FROM_ADDRESS="FROM"
MAIL_FROM_NAME="FROM NAME"
MAIL_ENCRYPTION=null
but nothing happen, only failed (I am using queue, and i have tested using mailtrap.io, everything works fine)
Anyone knows what is wrong with my config?
Thanks
Think you need ssl, try this:
MAIL_DRIVER=smtp
MAIL_HOST=mail.embara.id
MAIL_PORT=465
MAIL_USERNAME=noreply#embara.id # <-- full email address
MAIL_PASSWORD=secret
MAIL_ENCRYPTION=ssl # <-- This
I am configuring my Laravel app to send a welcome email, just like Jeffrey Way said at Laracasts and it works fine in Mailtrap. But when I change to HostGator, which I will use in real world, it just not work at all!
Here's some code:
MAIL_DRIVER=sendmail
MAIL_HOST=srv218.prodns.com.br
MAIL_PORT=465
MAIL_USERNAME=automatico#cepcar.com.br
MAIL_PASSWORD=******* <- obviously hidden
MAIL_ENCRYPTION=tls
Have changed the driver to SMTP, encryption to SSL, none but got no success. And the problem is that there are NO ERRORS to debug!
The following changes should solve your issue.
Set a mail from address which is same as MAIL_USERNAME.
Change your mail driver to smtp.
Change mail encryption to ssl.
MAIL_DRIVER=smtp
MAIL_HOST=srv218.prodns.com.br
MAIL_PORT=465
MAIL_USERNAME=automatico#cepcar.com.br
MAIL_PASSWORD=*******
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=automatico#cepcar.com.br
the best solution is to make the following configuration in the .env file in hostgator to be able to send the emails with the corporate emails you have to define your domain on the host
MAIL_HOST= mail.<tu_dominio> => mail.amazonventas.com
MAIL_PORT=465 => estatico
MAIL_MAILER=smtp
MAIL_HOST=mail.amazonventas.com
MAIL_PORT=465
MAIL_USERNAME=**********#amazonventas.com
MAIL_PASSWORD="*********"
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=********#amazonventas.com
MAIL_FROM_NAME="${APP_NAME}"
MAIL_DRIVER=mailgun
I tried to click on link forget password and it says email has been sent but I didn't receive email
I am using gmail smpt in db config
I have already tried to change the setting in .env file but still nothing
This is mail config
MAIL_DRIVER=mail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=username#gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
This isn't working it only says email has been sent but I didn't receive mail
I have also allowed in gmail to use Allow less secure apps: ON
so that app can directly send mail
You said you are using smpt driver. but in configuration you have set to mail.
So, you need to set MAIL_DRIVER from mail to smtp as given below:
'MAIL_DRIVER=smtp`.
Which password you are using ? Is that password which you are using to get login to gmail server ?
If yes then go to Myaccount of gmail then go to sign in and security and go to App password and generate password for Mail App and use that password.
May be that works for you. Same is working for me. Also change the following settings in your .env file.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_ENCRYPTION=tls
I changed the value of MAIL_DRIVER from mail to sendmail in the .env file
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=email#gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
In account setting of gmail allow unsecured app to send mail works for me