1

I'm successfully sending out email from a server using Postfix smtpd, but on the receiving end, the emails are just coming from dan@emerson (emerson is the name of the originating host), and not [email protected]. Thus they get put in spam. In main.cf I've set mydomain and myorigin to "mydomain.com" (the real domain withheld). Is there anything else I should check so I can get the outgoing emails to be sent from [email protected]?

1 Answer 1

3

Try with:

echo "Message body" | mail -s "Some subject" -r [email protected]  [email protected]
4
  • Thanks, this works, but I wonder why I don't need to use the -r option with mail when I do the same from a different Ubuntu server, which does put the domain name after the user name.
    – dan
    Jan 21, 2016 at 21:17
  • @dan A message is built of of fields - one field is typically the "From:" field, which you can use to specify what "From" address to send from. This is typically used to specify where emails are 'from' from the same server, so unless you specify the "From" field, it doesn't work very well and will default to user@machinehostname (rather than the myhostname settings). This way, one mail server can reply for multiple domains.
    – Thomas Ward
    Jan 21, 2016 at 21:19
  • @ThomasW. Is it usual to have to use the -r [[email protected]] flag when using mail to send email out of the local network? I hadn't thought that was the case.
    – dan
    Jan 21, 2016 at 21:26
  • 1
    @dan given my entire backend of how I test my mail server is done via Python, I don't typically test things like this. However, it's NOT uncommon to have to specify the origin address (i.e. the From address) in messages originating on the local network, when going outbound. It's actually RFC Dictated that you should have a From: field populated when sending a message, so unless it's specified, it's usually user@hostname gathered from the currently logged in session.
    – Thomas Ward
    Jan 21, 2016 at 21:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .