Saturday, November 12, 2016

exim - Cannot send mails to different domain with mail server in HostGator and website in Digital Ocean (From header is missing)

Recently I moved from HostGator with cPanel to a Digital Ocean droplet.



I still want to use the email service from HostGator.



So in DigitalOcean I added an A record pointing to HostGator IP, and MX record pointing to mail.mydomain.com



I can receive and send emails normally.




When I want to send an email from a Laravel application, unless it uses the same domain of my website, the mail is not sent, for example if I wanted to send to a Gmail account.



I tried with telnet, and in the inbox I saw that gmail rejects the message because it doesn't have a "From header".



Before the migration everything worked correctly so I don't think that I need to add that header to my Laravel email.



Is there something that I am missing in DNS configuration or cPanel?



This is the code that I've been using before the migration and it was working fine, now it sends emails but only when the recipient has the same domain as HostGator, which is my-domain.com:




MAIL_DRIVER=smtp
MAIL_HOST=cloud232.hostgator.com (I tried with mail.my-domain.com and it works too)
MAIL_USERNAME=noreply@my-domain.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl (I tried with tls and port=587 and it works too)
MAIL_FROM_NAME=name
MAIL_PORT=465 (I tried with tls and port=587 and it works too)



Thanks in advance.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...