[SOLVED] When sending mail - email "from" address is changed to the server's DNS name

(I thought this would be a faq, but I can’t find a solution.)

I am new to virtualmin and have installed it on AWS EC2 cloud on top of Centos 7. All seems to work so far except for the sending of email.

When I send email, either from the roundcube or a mail client (Thunderbird), the mail is accepted and delivered, but the domain part of the “from” address is changed.

For example, an address of:


dave@ec2-xx-xx-xx-xx.ca-central-1.compute.amazonaws.com (ip parts changed to xx)

This is not even the server’s hostname, which is set to a resolvable address in another domain whose reverse dns points to the server’s public ip address.

Any ideas what is happening? I even set the myhostname= in main.cf to what the hostname is set to and it did not make any difference.

— Dave

OK, I solved this problem myself.

I found that this problem was evident when the receiving email server was sendmail. Another server that I tried was postfix and that was fine. So, that meant that the From change was being done on the receiving end.

I had the dns for the virtual domain setup with the server IP set to a CNAME record equal to the ec2-xx-xx-xx-xx.ca-central-1.compute.amazonaws.com AWS address. I changed this to an A record set to the server’s IP and the problem went away. I have no idea why sendmail was doing this change.

— Dave