Droplet name is in the Mail From instead of domain name. Mailname file seems to be ignored.

I installed postfix following this tutorial. However, I had to edit the first line of the mailname file from to since I made a typo during the install. I can send a test email to myself and I did the setup to forward emails to root to me. But the mailname in the file is not used, instead the dropletname.localdomain appears in the Mail From in my tests.

myhostname = dropletname.local domain #I tried putting here but then I can no longer relay the emails to root to me
myorigin = /etc/mailname
mydestination =, $myorigin, $myhostname,, localhost

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Today, I attempted to add or set the sender email or From address in my command line test

echo "This is the body of the email. Will the FROM Email address be correct?" | mail -s "Mail from AmericanPharoah" -a "From:JohnK<>"

I received the email with the correct sender name and sender email address. Also when I check the ‘original’ message in the Gmail details I no longer see any mention of debian-s-1vcpu-1gb-blah-blah-blah for Return-Path or any other values in the email details.

I will try designating the sender in any SendOnly emails sent out by my site.

I reconfigured postfix by running sudo dpkg-reconfigure postfix This time I made sure to use which is correct.

After changing myhostname = debian-servernameetc.localdomain to myhostname = I now get the emails but it shows it is from root and when I reply it goes to root@debian-s-blahblahetc.localdomain

I checked the mainname file in the etc folder and I still have on the first line. In if I change the line myhostname = it gives me the 'process exited with non-zero status when I try to send an email to myself

Hmm, removed what I had there so now it is justmyhostname = then I restarted Postfix but now I get process exited with a non-zero status when I try to send an email to myself I wonder if I should run “sudo dpkg-reconfigure postfix” and make sure I use instead of this time

I just changed it back to myhostname = debian-blahblahblah.localdomain then restarted Postfix, and I was able to send myself an email using the mail command from the linux shell window