I have a lot of servers, let's say our company network is called Loosers, when using this command

echo "Subject: testmail $(hostname)" | sendmail -v 'myemail@mycompany.com'

I effectively receive an email after a few minutes, but the sender is like hostname@mail.loosers instead of something like noreply.hostname@mail.mycompany.com.

Since my predecessor stupidly set the domain to something specifically related to my company, I suppose it is possible to change this email. I browsed my server in /etc/mail/* , then the manual of sendmail, then the Internet in the search of the configuration of sendmail. Nowhere can be found the string looser or mail. I cannot grasp where my predecessor configurated this stupid default sender of sendmail.

How can I configure the default sender used by the bash command sendmail?

  • “the bash command sendmail” – That’s not a Bash command but most likely belongs to the postfix package. In that case you can set a custom envelope from-header using the -f argument. – phg Mar 15 '19 at 9:08
  • 1
    Look at the main.cf config file in /etc/postfix – Raman Sailopal Mar 15 '19 at 11:05
  • @RamanSailopal there is no /etc/postfix directory. – MUY Belgium Mar 15 '19 at 12:14
  • @phg the idea is not to use the -f flag... – MUY Belgium Mar 15 '19 at 12:14

Default mail depend upon the sender account : for root -> root@hostname.mycompany

If the email is changed, this can only happen on minedefang or postfix server. Revew the configuration of your relais servers.

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.