0

When I am sending mail by using below command in RHEL 7.4 server, I am receiving mail from root@<server name with fqdn>.

echo test|mailx -S smtp=mail.sap.corp -s "test" -v venkatesh.vishwanatham@aaa.com

But I want mail to be received like as below, please tell me what configuration needs to be changed in server.

from:
venkatesh,vishwanatham
1

I don't see anywhere in your example where you're doing anything to set a from header.

echo test | mailx -S smtp=mail.sap.corp -s "test" -v -r venkatesh.vishwanatham@aaa.com venkatesh.vishwanatham@aaa.com

If your version of mailx supports -r to set the from address, you can add that option.

If it doesn't you can try the option below. The first instance of the email address for venkatesh.vishwanatham is going to be used as the recipient. Passing -- -f <address> should cause mailx to ignore that option and pass it directly to the mailer.

Option 2:

echo test | mailx -S smtp=mail.sap.corp -s "test" -v venkatesh.vishwanatham@aaa.com -- -f venkatesh.vishwanatham@aaa.com

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.