My server is sending infinite mail with Laravel..
I tried testing a simple mail form, it returned a 404 and still sent a lot of e-mails. Now my server went crazy and is sending 14 e-mails per second on amazon SES.
I've tried:
restarting server
clearing the queue (no jobs are show in the database)
checking if retry has a limit, it is set to 3
went back to php5 (it was updated to 7 recently)
I'm using laravel 5.2.
My email sending logic:
\Mail::send('emails.contact', ['email_message' => $email_message, 'name' => $name], function($message) use ($to_email, $from_email, $name, $subject) {
$message->to($to_email)->from('my#server.com', $name)->replyTo($from_email, $name)->subject($subject);
});
PHP Log and Nginx logs shows no errors
Any ideas what I could do?
Related
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...
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))
);
}
It sounds like you have a bug where you are sending a DATA command without first sending a valid RCPT TO command. That might mean that none of your RCPT TO commands were accepted by the server. I suggest tracing the entire SMTP conversation so you can see how that might be happening.
I am using Exim mail server for my smtp and experiencing an issue when sending emails from the server if the connection is instantiated from within the server. However if I try authenticating from outside, emails are sent without any problems. Am using Laravel which ships with Swift mailer. This is the error laravel is giving out.
production.ERROR: Expected response code 250 but got code "550", with message "550 127.0.0.1 is _my_ address
Exim's log also has a similar error;
H=localhost [127.0.0.1] X=TLSv1:ECDHE-RSA-AES256-SHA:256 CV=no rejected MAIL <no-reply#mydomain.com>: 127.0.0.1 is _my_ address
My .env file has credentials set up correctly as follows
MAIL_DRIVER=smtp
MAIL_HOST=mydomain.com
MAIL_PORT=587
MAIL_USERNAME=no-reply#mydomain.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
The code used to send the emails is as below;
Mail::to('admin#mydomain.com')->send(new AlertEmail($information));
What am wondering is,could the problem be caused by trying to send the email to addresses within the same domain? I hope someone can help me out. Am almost going crazy.
NB: Roundcube is sending emails fine.
I am using Laravel 5.2. I am using Mail queue for sending email. Following is email queue syntax.
$mailArr = array();
$mailArr['subject'] = 'testing mail';
$mail_body = 'testing mail';
$mailArr['description'] = $mail_body;
Mail::to($email)->queue(new CustomMail($mailArr));
If I use "send" instead of "queue" then successfully receiving email.
Queue emails are going in Job table and attempting 3 times and then it is going in failed_jobs table.
In failed_jobs table, I am getting error ErrorException: fwrite(): SSL: Broken pipe in vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:231
I am processing queue with dispatcher and supervisor.
If I manually hit php artisan queue:work even then email is going but automatically with schedule:run written in cron job, is not working.
So any suggestions please what could be the reason?
This response is received when the remote connection closes without informing your server as to why. Usually due to a restriction, such as mail size.
Try using an alternative mailer, such as Mailtrap for example and try the queue again to see if the error response is different.
It is likely you had a plumbing issue; a huge email in your queue prior to your other emails, that’s why sends were processing fine but your queue wasn’t.
I am having an App developed on Laravel 5.4. I used to have my project setup on Xampp on Windows and also under vagrant Machine.
The problem is that when I switched to MacOS and Valet, I have started getting problems with routes that were sending requests via Guzzlehttp package.
They imideatelly responded with 502 Bad Gateway
nginx/1.13.10, though I could access the same endpoints on 3rd party domains directly and even though I wrapped the code with exception handler.
How can I solve that problem?
I had a problem of 502 Bad Gateway using Guzzle. I fixed it by removing User-Agent from request.
$client = new \GuzzleHttp\Client();
$res = $client->request('GET', 'https://www.example.com', [
headers' => ['User-Agent' => null]
]);
Can any one tell me why I'm getting this error with codeigniter when it comes to sending mail.
some time it work fine some times i get this error
451 Please try again later
The following SMTP error was encountered: 451 Please try again later
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
Are you sure your SMTP server is working fine at the time you get this error? If it works sometimes, then that means that your configuration is probably fine. I'd deploy the code of a test server online and then run your code to see if its really a configuration problem or maybe a problem with the SMTP host that you're trying to send the mail through.