For a username "A&B
"
[abuser@myserver] chfn -f "A&B"
Changing finger information for abuser
Password:
Finger information changed.
[abuser@myserver] mail -s Test [email protected]
Hello World!
Cc:
[abuser@myserver]
When this mail arrives, "&
" appears to be replaced by the username in the From field in the email.
From: AAbuserB [abuser@myserver]
Try with
Try with Quoted Printable Encoding:
where
=26
is the ampersand. Looks ugly, but should do the trick.Edit: It is not
mail
, but you should then try other alternatives: Use sendmail (the interface of your MTA and not sendmail itself). Ormutt
is also good for scripted sending of mails. Themail
command is too restricted in functionality in this case. And if you really need amail
command then you need to write a wrapper calledmail
that internally callsmutt
for sending.This behaviour is caused by the Mail Transport Agent (MTA) handling of
&
characters in the mailbox name in/etc/passwd
From the passwd man page:
The workaround in this case is to explicitly set the From address in the mail client.
For example, using
mutt
(as suggested by @mailq):Sending a test email...
Seems to work fine.