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.
Related
I have a Laravel 9.x site that I'm hosting on IONOS (shared-hosting).
In my site, I utilize mail a lot. So I'm sending mails to my customer frequently. While developing the system - I was using MailTrap.io - but for deployment, I need all the mails to go to my IONOS Mail Account i.e info#domain.com - for that, I need to use IONOS' Mail Configuration.
Following is my mail config (censoring out private info):
MAIL_MAILER=smtp
MAIL_HOST=smtp.ionos.com
MAIL_PORT=587
MAIL_USERNAME=############.com
MAIL_PASSWORD=################
MAIL_ENCRYPTION=tls
MAIL_FROM_NAME="${APP_NAME}"
MAIL_FROM_ADDRESS=#############.com
This is the error I'm getting:
This is the piece of manual documentation I got from IONOS' Dashboard:
How do I fix this? What is causing this issue? Like I mentioned before, all of it was working fine with MailTrap.io - so I'm really curious what am I doing wrong.
Thank you :)
As per ionos.com documentation
550 Sender address has null MX
The domain from which you send email has a configured No Service MX record (zero MX). The IONOS SMTP recipient rejects such emails
Delete the No Service MX entry in the DNS settings of your domain. For more information about a No Service MX entry, see RFC 7505.
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
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.
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.
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.