Smtp Gmail Not Working As I tried All in live server - laravel

MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=some-email#gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
I tried ssl and tls with their respective code but shows Swift_TransportException
Connection could not be established with host smtp.gmail.com [Connection timed out #110]
Mail::send('email.contact', $data, function($message) use ($data){
$message->from($data['email']);
$message->to('abc#gmail.com', 'Admin');
});

Generally gmail is not recommended to send emails on live server, but if you just using it for testing purpose than make sure you have allowed less secure app to YES under https://myaccount.google.com/security and allow captcha at https://accounts.google.com/b/0/DisplayUnlockCaptcha.
After performing above actions just clear your cache and email should work fine.

You are trying with 465 port with SMTP which is fine but can to try with 587 port.

Related

Connection could not be established with host smtp.office365.com :stream_socket_client(): php_network_getaddresses

I'm getting this error when sending an email via Office 365 from a Laravel system.
But the peculiarity is that it is random. It is not a mail configuration problem. Sometimes it works, sometimes it gives the error.
I think Office 365 is doing a lock. But the error message confuse me.
Has it happened to someone? Thanks!
Connection could not be established with host smtp.office365.com :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known site:stackoverflow.com
if you are sure that you configure the mail correctly
MAIL_DRIVER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME= //your username
MAIL_PASSWORD= //your password
MAIL_ENCRYPTION=tls
according to this issue discussions, it seems that it may related to WHM/Cpanel Users-- there is a tweak setting that may be tripping you up and redirecting outgoing email connections to localhost (which is then rejecting your connection).
https://features.cpanel.net/topic/change-fka-smtp-tweak-behavior-to-encourage-correct-user-behavior
if your are using GoDaddy Linux hosting try this:
mail_mailer=smtp
mail_host=localhost //using localhost cause we are in the same domin
mail_port=25
mail_username= //keep it empty
mail_password= //keep it empty
mail_encryption= // keep it empty
mail_from_address=username#udomin.com//this same for your email username
mail_from_name=stackoverflow // any name
see we are use this setting because we are in the same serve

Laravel Email is not sending due to the Failed to authenticate on SMTP server with username

I have a problem when I send mail from localhost everything works fine, but when sending from the server I don't receive mail and I get an error. Failed to authenticate on SMTP server with username please help me how can resolve that? thanks.
please check the error thanks.
https://flareapp.io/share/RmrlNRN7
Swift_TransportException
Failed to authenticate on SMTP server with username "zubair.bhw#gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "534", with message "534-5.7.9 Application-specific password required. Learn more at 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor c25sm22236461edt.0 - gsmtp ". Authenticator PLAIN returned Expected response code 235 but got code "534", with message "534-5.7.9 Application-specific password required. Learn more at 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor c25sm22236461edt.0 - gsmtp ". Authenticator XOAUTH2 returned Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials c25sm22236461edt.0 - gsmtp ".
https
.env
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=zubair.bhw#gmail.com
MAIL_PASSWORD='12345678'
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=zubair.bhw#gmail.com
MAIL_FROM_NAME="${APP_NAME}"
MALE_TO=zubair.bhw#gmail.com
Try port 465 instead of 587 as Gmail normally uses that one. Check if
port is blocked on your live server. Login to your gmail account(
mygmail#gmail.com ). Go to https://myaccount.google.com/security ,
Scroll down till bottom of page. In right you will see: Allow less
secure apps, make sure that option is on.

Am experiencing issues with email delivery-"response code 250 but got code '550' "

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.

How can I change outgoing mail configuration in Laravel?

My email setting in env like this :
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=secret#gmail.com
MAIL_PASSWORD=secret
MAIL_ENCRYPTION=tls
It works. But, I want to change email sender. So I don't use email sender gmail
My boss gives me a new email setting like this :
Mail Client Manual Settings
Secure SSL/TLS Settings (Recommended)
Username:contact#secretshop.id
Password:secret
Incoming Server:
palasik.in-hell.com
IMAP Port: 9xx
POP3 Port: 9xx
Outgoing Server:
palasik.in-hell.com
SMTP Port: 465
IMAP, POP3, and SMTP require authentication.
Non-SSL Settings (NOT Recommended)
Username:contact#secretshop.id
Password:secret
Incoming Server:
mail.secretshop.id
IMAP Port: 1xx
POP3 Port: 1xx
Outgoing Server:
mail.secretshop.id
SMTP Port: 587
IMAP, POP3, and SMTP require authentication.
I want to ask some questions
What is the difference between Secure SSL / TLS Settings and Non-SSL Settings?
what is the difference between incoming Server and Outgoing Server?
What new setting is more suitable?
I tried like this:
MAIL_DRIVER=smtp
MAIL_HOST=mail.secretshop.id
MAIL_PORT=587
MAIL_USERNAME=contact#secretshop.id
MAIL_PASSWORD=secret
MAIL_ENCRYPTION=tls
Is it the best choice?
Its always recommended to use SSL as it is secured & reduces the changes of the sent mail being filtered by the recipient's host as spam.
Most email accounts have two servers:
one that lets you send emails to other people,
and another that lets you receive the emails that other people send
you.
The server that lets you send mail is called an outgoing, or SMTP server. The server that lets you receive mail is called an incoming, POP, or just Mail server.
To change the sender config in Laravel use in .env file:
MAIL_DRIVER=smtp
MAIL_HOST=palasik.in-hell.com
MAIL_PORT=465
MAIL_USERNAME=contact#secretshop.id
MAIL_PASSWORD=secret
MAIL_ENCRYPTION=ssl
You can setup the config on config/mail.php or on the .env of your app.

Error while sending mail on https in laravel

Below is my configuration on mail in .env file.
MAIL_DRIVER=smtp
MAIL_HOST=mail.domain.com
MAIL_PORT=587
MAIL_USERNAME=username#domain.com
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls`
When I used the http the above settings works fine, meaning, I can send mail to the client. But, when I used the https secured, it contains an error: Connection could not be established with host mail.domain.com [Connection refused #111]
I tried to use the port provided by the the host but still there is an error : connection timeout
I want to use the https since it is secured. Does anybody know how to fix this error on https?
I got it worked. I just changed the Mail driver to mail:
`MAIL_DRIVER=mail`
and the Mail_port assigned by the hosting.

Resources