32

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

Primecore
  • 511
  • 1
  • 6
  • 17
  • 1
    What is this program you have uploaded? What steps have you taken? Where does the error occur? If we have more information it will be easier to help you. – Kalle Jun 30 '15 at 08:44
  • 1
    What hosting company are you using? More likely this is because your hosting company blocks outgoing traffic on 587. – Blaatpraat Jun 30 '15 at 08:45
  • @silverskin its a personal website. this page acts as contact us page. i didn't touch the mail.php anymore because it is working well in my localhost. so i assumed that it will do its job ones i've uploaded it. – Primecore Jun 30 '15 at 08:51
  • @Blaatpraat hostinger. i'm just using free domain and hosting. i am just testing it if it will work IRL. i am using my personal e-mail to receive the message – Primecore Jun 30 '15 at 08:51

7 Answers7

13

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

enter image description here

Community
  • 1
  • 1
code-8
  • 54,650
  • 106
  • 352
  • 604
11

we solved this problem by clearing the Laravel's configuration cache

php artisan config:clear

Renoir Reis
  • 359
  • 4
  • 17
  • 1
    Fixed it for us. – JohnL Jan 03 '18 at 14:22
  • nice to hear it. Whenever i got stuck with laravel config problems i imediatly run `composer dump autoload` and `php artisan config:cache`, their are the best chances you have to start a problem solving on laravel. – Renoir Reis Jan 04 '18 at 13:28
  • As it turned out, it was not a permanent fix. Ultimately I created a new Sendgrid account for that client which fixed issue - how I have no clue, but it did. – JohnL Jan 05 '18 at 14:34
  • have you checked your Sendgrid's send limits? Based on what your are describing the problem seems to be related to Sendgrid not with Laravel or PHP. – Renoir Reis Jan 05 '18 at 22:22
7

looks like the smtp was blocked for hostinger free users.

http://www.hostinger.ph/forum/news-and-announcements/229-email-service-updates-1.html

Primecore
  • 511
  • 1
  • 6
  • 17
  • 4
    @Primercore its always good practice to mark the answer which worked for you as an accepted answer. This way other users will have more confidence using this solution. I have noted you lately not marking some of your working answer as accepted. And you can also accept your own answer. Thanks for contributions to community. – hhsadiq Jul 24 '15 at 09:43
5

This one worked for me, 'if you are using GMAIL'

  1. Go to 'My Accounts'
  2. Go to 'Sign-in & security'
  3. Scroll down to 'Allow less secure apps'
  4. 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
mpalencia
  • 5,481
  • 4
  • 45
  • 59
1

I've a working laravel swiftmailer using google server. Here my steps:

  1. I visited the link https://www.google.com/settings/security/lesssecureapps and turned on less secure apps.
  2. 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.

  1. 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.

  1. 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
Rejaul
  • 831
  • 1
  • 12
  • 35
1

FWIW - I get this error when sending a email with an empty string in the to field.

phirschybar
  • 8,357
  • 12
  • 50
  • 66
0

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.

Mike
  • 751
  • 1
  • 6
  • 17
bob tian
  • 1
  • 1