23

Running the sendmail command I usually get emails with sender like username@hostname.

Is there a way to send emails using sendmail and having the sender set to something different from the user account used to run the command?

1 Answer 1

45

What you're looking for is -f:

sendmail -F "Your name" -f "[email protected]" < your-message.txt

From the sendmail man page:

 -Ffullname  Set the full name of the sender.

 -fname      Sets the name of the ``from'' person (i.e., the sender of the
             mail).  -f can only be used by ``trusted'' users (normally
             root, daemon, and network) or if the person you are trying to
             become is the same as the person you are.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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