Sending email from Laravel using Gmail - laravel

I have been using Laravel for a little while now, so thought I would dive into HTML emails, so I followed a tutorial.
The issue I have, as well as seemingly quite a few others is this:
Swift_TransportException in StreamBuffer.php line 269:
Connection could not be established with host smtp.gmail.com
[A connection attempt failed because the connected party did not properly respond
after a period of time, or established connection failed because connected host has failed to respond.
#10060]
My .ENV
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=EMAIL
MAIL_PASSWORD=PASS
MAIL_ENCRYPTION=tls
I have also tried ports 25 and others suggested, as well as ssl as opposed to tls, I have also tried using sendmail as opposed to smtp.
Further to this, I have the same issue when trying with an Outlook account.
I even enabled the option to accept items from less secure applications.
Anyone else experiencing these issues?
UPDATE:
I am having the same issues with Mail Trap, could it be my laravel install?
Also tried with a fresh install...
FURTHER UPDATE
When I ping any site, I get request timed out, which means I think my router is blocking me?

According with help for administrator page of Google, when you try to connect by port 465 this requires encryption SSL, on the contrary if you use TLS you should set the port to 587, try changing the port on your .env file.
Reference: https://support.google.com/a/answer/176600?hl=es

.env file
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=youremailaddress
MAIL_PASSWORD=yourownpassword
MAIL_ENCRYPTION=tls

Related

Failed WebSocket Connection (Pusher.com and Laravel)

I have a problem with websocket connection.
This is the error in the browser. I am getting a message in pusher.com just then I refresh the page, but not every time the websocket connects. I think something is wrong with my .env file, but not sure.
.env file:
PUSHER_APP_ID=...
PUSHER_APP_KEY=...
PUSHER_APP_SECRET=...
PUSHER_HOST=null
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=eu
What host should I write to solve it? Or the problem is somewhere else?
When connecting to Pusher you do not need to set the host or port. You can remove these variables and then the library will be able to connect to Pusher.

Send outlook email through proxy server in Laravel

How can I send an outlook email through a proxy server?
I am working for a company on a project, and I want my laravel project able to send the email. But, the company is protected by a proxy server and whenever I want to send email, I will get below kind of error:
Connection could not be established with host smtp.mailtrap.io >:stream_socket_client(): unable to connect to tcp://smtp.mailtrap.io:2525 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
my .env file:
MAIL_MAILER=smtp
MAIL_HOST={proxy_address}
MAIL_PORT=587
MAIL_USERNAME=*******#{Company_domain}.com
MAIL_PASSWORD=***************
MAIL_ENCRYPTION=''
HTTPS_PROXY = {proxy_name}:{proxy_password}#{proxy_address}:{port}

EC-2 suddenly stopped sending smtp.gmail.com mail - connection timeout

Im running a Laravel 6 app on AWC EC-2 instance and have it configured to send mail via Gmail SMTP. Has worked perfect for nearly 2 years. Approx 1-1.5 days ago, the email function started throwing the Connection timed out error.
I tried switching ports, and changing TLS to SSL and no change.
Ive read dozens of threads with the same problem - but no help. Most suggest changing from driver smtp to sendmail - but that breaks all my email-send code.
I tried to telnet smtp.gmail.com 587 from the command line - and get Host is unreachable. There has been NO change to the code, config or setup recently.
My thoughts right now, are either:
AWS have blocked my smtp port,
Google has blocked my IP from sending mail,
My server MAY have reached a limit of some sort (but thought it will un-suspend in 24hrs if the case)
I am not sure HOW or WHERE to find that answer, or if there is another possible problem/solution here. I only have Basic support with AWS - so cant raise a standard tech support q.
Any suggestions would be greatly appreciated.
With thanks - James (Image of error and env below).

fwrite(): send of 6 bytes failed with errno=32 Broken pipe laravel

when i am using smtp without ssl it giving this error
MAIL_DRIVER=smtp
MAIL_HOST=mail.onestopdigitalagency.com
MAIL_PORT=587
MAIL_USERNAME=thankyou#onestopdigitalagency.com
MAIL_PASSWORD=********
MAIL_ENCRYPTION=
a month ago it was workig fine
and if I use this it send email but not to gmail
MAIL_DRIVER=smtp
MAIL_HOST=mail.onestopdigitalagency.com
MAIL_PORT=465
MAIL_USERNAME=thankyou#onestopdigitalagency.com
MAIL_PASSWORD=********
MAIL_ENCRYPTION=ssl
and on tls setting it giving timeout error
I recently ran into this problem with an email provider that upgraded their services to have tighter TLS security requirements. The error was the result of the remote connection being forced closed. In your case, you were not using encryption and it was working fine, but now they are requiring encryption and their SMTP server is closing the connection.
You could also use the tls setting if you change the port to 587. Port 465 is SSL, TLS is used with ports 25 or 587.

Connection could not be established with host laravel 5.4?

i am using virtual host but phpmyadmin is also pointed to virtual host ip and working perfectly
when i register a account on my laravel project i am getting following error .
Connection could not be established with host [No connection could be
made because the target machine actively refused it.
#10061]
in my logs
#10061] in C:\xampp\htdocs\upload\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php:268
Stack trace:
This error can be caused by having the wrong values configured for MAIL_PORT, MAIL_ENCRYPTION, and occasionally MAIL_HOST.
swiftmailer is the library that sends email. You're getting the error when you register and Laravel tries to send an email.
"...the target machine actively refused..." means that the host resolved successfully, but the other computer either has a firewall blocking the port or no process is listening on that port.
Your mailer service should tell you what port to use in their documentation. If using MAIL_DRIVER=smtp and MAIL_ENCRYPTION=tls, typically this will be port 587, 465, or 25.

Resources