PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 16, 2022

[FIXED] Expected response code 354 but got code "503", with message "503 5.5.1 RCPT first. w15sm3670747wrs.80 - gsmtp "

 February 16, 2022     gmail, laravel, laravel-5, smtp     No comments   

Issue

I am using Laravel 5.8 and I am trying to send email from system using below setting. when is send email one by one its working fine but when I send bunch of marketing email together it stopped after sending 20 email and giving me below error.

I am using below setting in .env.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=my user name
MAIL_PASSWORD=my gmail app password

I am getting below error after sending 20 emails

Expected response code 354 but got code "503", with message "503 5.5.1 RCPT first. w15sm3670747wrs.80 - gsmtp "

also I tried with TLS but it's giving me same error after 20 emails...


Solution

All email senders have a limit of how many emails can be sent in a particular second. Amazon's SES, for example, has limit of 40 emails per second.

I am using this logic to solve this issue:

$count = 0;
foreach ($users as $user) {
    $count++;
    $user->notify(
        (new Notification($emailBody))
            ->delay(intdiv($count,30))
    );
}


Answered By - Jigar
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing