How to replace sender address with his name using mailx command?

I was using following command but it was still giving mail address and not name :

echo test | mailx -r "Singh,Vivek <vivek.x.singh@xyz.com>" -s "Test mail" vivek.x.singh@xyz.com

I am currently using Solaris 10 OS.

What I want : In my mailbox, from: should show "Singh,Vivek" instead of "vivek.x.singh@xyz.com"

  • It's odd, but on a Solaris 10 server I have access to, removing the -r option seems to do what I think you desire. – Deathgrip Jun 19 '17 at 16:44
  • 1
    That's not a valid address. A real name which contains a comma needs to be quoted. Try mailx -r '"Singh, Vivek" <vivek.x.singh@xyz.com>' to pass in an address in valid format. – tripleee Jun 19 '17 at 16:59
  • @tripleee, It is still sending mail address and not name. Please test it at your end and let me know. I want Singh, Vivek in the sender address of my mailbox. – Raid_Master Jun 21 '17 at 12:01
  • I don't have access to Solaris so I can't test. Are you saying the From: header is not used to display the sender's identity in mailx on Solaris? – tripleee Jun 21 '17 at 14:03
  • @tripleee See mailx -r is working fine but -r option is only accepting mail address as an argument. I was asking you if there is any way I can pass sender's name as an argument – Raid_Master Jun 21 '17 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.