1

I have added my first Azure server for production use on my domain. Azure assigned a domain name in their DNS, I created a CNAME entry in my domain to forward there. Works great.

When I enter the command hostname --fqdn, I get myvmname.[someuniquechars].bx.internal.cloudapp.net

Now I am using email on the Ubuntu server, and by default, emails are from myuser@[someuniquechars].bx.internal.cloudapp.net

I am using a smarthost to send all email through my corporate email system, and it doesn't forward emails from users on other domains.

I would like to do whatever is proper and acceptable such that when I type hostname --fqdn I see myvmname.mycompany.com And when I send emails, the from address is myuser@mycompany.com

I'm a little concerned that if I set the domain to mycompany.com that emails to others @mycompany.com will attempt to get delivered here on this box, rather than sent through the corporate smarthost... Perhaps I should abandon linking my corporate email suffix to emails generated on this box, and instead create a working subdomain for this machine, complete with valid MX records etc. So emails sent from a user on this machine would be from user@myvmname.mycompany.com.

I'm moderately capable in Linux, but not a Linux/Ubuntu wiz. I've done some research but there are several responses I've seen that are either contradictory, or overly simplistic. Some utilize a tool (resolvconf) that worked in 16.04 but is not installed by default in 18.04, perhaps it conflicts with something else? It was all confusing enough to ask this question on the forum.

1

I'll answer my own question...

It was actually simple to do - just edit /etc/hosts and add the second line shown below underneath the first. In this example, the host name is now "myservername" and the fqdn for the server is "myservername.mydomain.com"

When using sendmail, sending an email from user1, the from address becomes "user1@myservername.mydomail.com"

This actually resolved the issue I had. It would be possible to send mail @mydomain.com (removing the hostname from the email address) using Masquerade features of sendmail, but it turns out I have no need to do so, and it would lead to more complications to deal with.

127.0.0.1 localhost
127.0.0.1 myservername.mydomain.com myservername

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.