Question

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

Posted December 25, 2019 676 views
EmailDebian 9

I installed postfix following this tutorial. https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-debian-9 However, I had to edit the first line of the mailname file from americanpharoah.com to americanpharoah.ca 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 americanpharoah.ca here but then I can no longer relay the emails to root to me
myorigin = /etc/mailname
mydestination = americanpharoah.ca, $myorigin, $myhostname, localhost.americanpharoah.ca, localhost

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.

×
4 answers

Hello, @johnrobertkosanovic

Could you please check the myhostname value in the Postfix configuration file: /etc/postfix/main.cf

You need to look for the following line:

myhostname =

If this line is not present in the file you can add it, restart postfix and test again.

Hope this helps.

Regards,
Alex

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 americanpharoah.ca instead of americanpharoah.com 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

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

After changing myhostname = debian-servernameetc.localdomain to myhostname = americanpharoah.ca 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 americanpharoah.ca on the first line. In main.cf 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

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<johnk@americanpharoah.ca>" MyRealGmailAddress@gmail.com

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.

Submit an Answer