I'm trying to send mail using laravel notification class and its giving me this error. Can anyone help?
stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:\n
error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version
Below are the solutions that might help you.
Make sure your configurations of php.ini are correct.
Turn off your anti-virus.
Your provided account for sending emails is verified.
Related
I deploy my Laravel + vue project on the Digitalocean apps and some of my api are working but some are not.
When I look into the api response I received message: "Server Error",
But the api is working on localhost and gives error after the deployment.
Is there a way to view the actual error message of the api reponse? so that I can easily understand what causing the error and fix it.
But I really find it weird that it causing error in the digitalocean apps, but works on my local machine.
I've tried searching for hours how to view the errors but I can't find it.
please help me. Thank you!
You can log in to your server and look in the file storage/logs/laravel.log.
Otherwise, I would suggest using a service such as Bugsnag or Sentry, which have integrations with laravel and will give you a dashboard with all your errors
Some people suggest putting APP_DEBUG to true, but that is a security risk as your customers will be able to see the error as well, and you should never do this on a production server
I'm running Laravel 6.20.0 and I'm experiencing the following error since yesterday when my queue worker is trying to send an email:
Swift_TransportException: Expected response code 250 but got an empty response in public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:448
I've tried requeuing my emails several times now since yesterday, but I keep on receiving the same error when it attempts to send. This worked flawlessly before for almost a year, so I'm a bit confused what is causing this issue. I haven't changed any credentials nor changed any code or configuration recently.
My mail settings are as follows:
MAIL_DRIVER=smtp
MAIL_HOST="smtp-relay.gmail.com"
MAIL_PORT=587
MAIL_USERNAME="my#user.name"
MAIL_PASSWORD="myapppassword"
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="my#from.address"
MAIL_FROM_NAME="My Name"
I've doubled checked in my Google Admin that both the IPv4 address as well as the IPv6 address of my server are whitelisted and the SMTP relay service is enabled. I also created a new App password within my Google account to see if that would fix the problem - but no luck there.
I've also cleared the config cache (and have tried php artisan config:cache) and tried restarting supervisor which runs the worker running the task for the email queue. I've also tried requeueing the emails one by one in case I triggered some kind of throttling, but to no avail. By no means is my website sending many emails, about a 100 a month, well within the limits posed by my email account. (And I currently got <10 stuck in queue.)
As a last resort I turned off SMTP verification and TLS encryption in the Google Admin, so the only requirement for using the SMTP was having the IP address whitelisted (which it is). But this didn't work either, so I've switched SMTP verification and TLS encryption back on again as a requirement.
Finally; I ran a composer update, but that didn't fix the problem either.
I've found some other older threads on Stackoverflow with a similar problem, but I had already tried all offered solutions as described above.
What am I missing?
i think you need change mail port to 25 like this :
MAIL_PORT=25
Just faced same issue.
In my case SMTP sending worked when I tried to send an email without queues.
But when I tried to send same email with same config using queue, I got error that looks like:
[2021-02-15 12:43:24] local.ERROR: Expected response code 250 but got an empty response {"exception":"[object] (Swift_TransportException(code: 0): Expected response code 250 but got an empty response at /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:448)
[stacktrace]
#0 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(345): Swift_Transport_AbstractSmtpTransport->assertResponseCode('', Array)
#1 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php(305): Swift_Transport_AbstractSmtpTransport->executeCommand('HELO [127.0.0.1...', Array, Array, false, NULL)
#2 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(368): Swift_Transport_EsmtpTransport->executeCommand('HELO [127.0.0.1...', Array)
#3 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php(341): Swift_Transport_AbstractSmtpTransport->doHeloCommand()
#4 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(148): Swift_Transport_EsmtpTransport->doHeloCommand()
After long research I've found that issue is related with HELO command itself.
As you can clearly see in the log, for some reason (probably server hostname) there is 127.0.0.1 IP address, which Google is blocking.
How I resolved that:
So to resolve that, I've added one little line in my artisan file:
$_SERVER['SERVER_NAME'] = 'mydomain.com';
So my artisan file looks like this now:
#!/usr/bin/env php
<?php
$_SERVER['SERVER_NAME'] = 'mydomain.com';
define('LARAVEL_START', microtime(true));
...
Spoke with Google Workspace rep
As a temporary solution they asked to use
smtp.gmail.com instead of smtp-relay.gmail.com
Worked on 2 of our projects.
P.S. The limit is 130 emails per account on Workspace (former Gsuite)
for example if you have 5 users, 5x130=650
What the rep said haha :)
I can send email in my localhost, but when I put it in our remote server I get this error:
I don't know what the problem is. Anyone?
I used the laravel default mail driver which is swiftmailer.
Check your gmail: in settings, enable access for less secure apps and it will work.
When I try to fetch contacts from gmail, I received this error message:
The page you have requested cannot be displayed. Another site was requesting access to your Google Account, but sent a malformed request. Please contact the site that you were trying to use when you received this message to inform them of the error. A detailed error message follows:
The site "http://url.com" has not been registered.
May I know how to rectify it? Thanks!
Have you tried registering the domain with Google's API?
docs:
https://developers.google.com/accounts/docs/RegistrationForWebAppsAuto#new
resgister url:
https://accounts.google.com/ManageDomains
Also if you are making calls from http and not https you may be seeing problems there too.
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.