This code was working fine previously and laravel abruptly stopped sending mail since last week. I tried to send mail using swiftmailer separately with same credentials which is also working fine. I have following credentials on .env file for mail functionality in laravel-
MAIL_DRIVER=mandrill
MAIL_HOST=smtp.mandrillapp.com
MAIL_PORT=465
MAIL_USERNAME=*******
MAIL_PASSWORD=*******
MANDRILL_SECRET=*********
MAIL_ENCRYPTION=ssl
I configured /config/services.php and /config/mail.php files to.
There is no error in Mail::failures().
what could be the possible reason for such problem.
I can send mail with templates using swiftmailer but it's necessary to figure-out the problem to fix such problems with no time in future.
Related
I have multiple websites that contain a function that sends emails, the websites are hosted on AWS Linux hosting and I'm using cPanel.
an issue with sending emails started today, it stopped sending emails from all of the websites, I tried changing the function and several other things but nothing worked, and I don't see any errors in the error logs of the websites.
I'm using the following to send the emails:
Illuminate\Support\Facades\Mail
here's the function in the email controller:
Mail::send(['text'=>'Mail.name'],$data, function($message) use ($hostName) {
$message->to('TO EMAIL ADDRESS')->subject('subject');
$message->from(config('mail.from.address', ''),$hostName);
});
here's .env email configuration:
MAIL_DRIVER=sendmail
MAIL_HOST=mail.domain.com
MAIL_PORT=587
MAIL_USERNAME=[hidden]
MAIL_PASSWORD=[hidden]
MAIL_ENCRYPTION=''
I tried using smtp driver, port 465, nothing worked.
the from email I'm using is a cPanel email.
I'm using laravel 9 and PHP 8
I'm using ovh cloud server and laravel forge to manage my server, I don't know what happened exactly, I have websites and even wordpress installed , everything was fine and can send email from all websites, nowadays no website send email also no error in the log files, and the email function works fine but no email in inbox or even spam
I've tried changing mail to sendmail, the same issue
please advice me
MAIL_DRIVER=mail
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=noreply#****com
MAIL_PASSWORD=*******
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=noreply#*****.com
MAIL_FROM_NAME=“****”
If your using gmail, delete and create new app password. Here is my config
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=***#gmail.com
MAIL_PASSWORD="*****"
MAIL_ENCRYPTION=tls
I'm trying to send email with my laravel local app using MDaemon WorldClient Private Email email server but i always get this error
Expected response code 250 but got code "530", with message "530 5.7.0 Authentication required"
With my laravel local app, I already tried to send email using mailtrap and gmail and both works fine.
This is my email configuration in .env file
MAIL_DRIVER=smtp
MAIL_HOST=mail.emaildomain.co.id
MAIL_PORT=587
MAIL_USERNAME=myname#emaildomain.co.id
MAIL_PASSWORD=******
MAIL_ENCRYPTION=null
To see if there's something wrong with my email configutraion, I also tried to send email using outlook on my computer with the same email account and configuration that I use on laravel and it works perfectly on outlook. I already double check the outlook SMTP configuration and the laravel but I have no idea why it always fails on laravel.
By the way, i'm using mailable on laravel.
Thank you
Sorry I did a silly mistake.
It's just the from parameter of the email and the email username doesn't match.
Just for a tip, make sure you set all the email config on the .env file. It'll help you a lot. I did the mistake because I set the from parameter in Mailable class and the other in .env.
I am sending mail from laravel its working fine on localhost but same code is not working on live server following is my mail configuration
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=pranav.bitware#gmail.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=ssl
i have allowed less secure apps in my account
i don't know why its generating error on live server
on some articles they are setting smtp to sendmail i tried that also but getting same error
Providing the error message you get will help with troubleshooting this issue. Since it works on your localhost, then you should look into the server configuration such as your php and Laravel setup, and firewall settings.
I can send my emails in localhost flawlessly. but ever since I uploaded my program into a hosting site I get this error
Expected response code 250 but got code "", with message ""
I also updated the .env file.
MAIL_DRIVER=smtp
MAIL_HOST=smtp-mail.outlook.com
MAIL_PORT=587
MAIL_USERNAME=email#outlook.com
MAIL_PASSWORD=123456789
works in localhost but not in the hosting site.
i am using laravel 5
I ran through this error so many times for some reasons.
When see this error,
Expected response code 250 but got code “”, with message “”
Please triple check your email password.
Note :
Test your credentals first on a phone app or log-in into the mail site.
If pass, you may update in your .env file
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mail.yahoo.com
MAIL_PORT=465
MAIL_USERNAME=dev.bheng#yahoo.com
MAIL_PASSWORD=****
If you know for sure that your password is correct.
Check to make sure your Gmail or Yahoo Mail allow app log-in.
Example
Yahoo
we solved this problem by clearing the Laravel's configuration cache
php artisan config:clear
looks like the smtp was blocked for hostinger free users.
http://www.hostinger.ph/forum/news-and-announcements/229-email-service-updates-1.html
This one worked for me, 'if you are using GMAIL'
Go to 'My Accounts'
Go to 'Sign-in & security'
Scroll down to 'Allow less secure apps'
Switch #3 to ON
After doing this and if you just recently set up your email configurations on laravel and still doesn't work, try running:
php artisan config:cache
I've a working laravel swiftmailer using google server. Here my steps:
I visited the link
https://www.google.com/settings/security/lesssecureapps and turned
on less secure apps.
I edited .env file as like below:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=username //i.e. username#gmail.com
MAIL_PASSWORD=password //Gmail accounts password
MAIL_ENCRYPTION=ssl
Edit username and password with your own.
In my controller, I wrote the following code:
$rawData = request::all();
Mail::queue('program.meeting.emailInvite', $rawData, function($message) use ($rawData)
{
$message->from('info#echosofts.com', 'Echosofts')->to(array_map('trim', explode(',', $rawData['all_email_id'])))->subject($rawData['mail_title']);
});
Then email was working fine except the sender email ID was my google account (username#gmail.com) instead of info#echosofts.com.
To overcome the sender email changing problem, I visited my google account and did the following:
"Setting icon"-> Settings -> Accounts and Import->Send mail as->Add another email address your own.
The following settings depends on your configuration.
Email address: info#echosofts.com
SMTP server: mail.echosofts.com
Username: info#echosofts.com
password:**********
Port:25
FWIW - I get this error when sending a email with an empty string in the to field.
in "mautic" (CRM), if you mail to a large amount of contacts, like more than 10k this occurs. The real reason is mostly a wrong configuration in php settings. For example:
max_input_time = 60
Will only let your server run the script for 60 seconds, try a higher value.
PHP configuration depends on your server and its installed software, mostly configured by htaccess or php.ini file.