Operating System - Linux
1753878 Members
7246 Online
108809 Solutions
New Discussion юеВ

to change "from" field in mail

 
kumar nishant
Occasional Contributor

to change "from" field in mail

Hi,

I am using linux system. i want to send email from different user for example:- suppose i have logged in as user "xyz@f00.com" but i want, if i send am email, it should show user as "abc@company.com".
Can anybody guide me with detailed steps as i have very few knpwledge regarding sendmail. Please consider that i do have root previleges.

Regards,
Kumar Nishant
14 REPLIES 14
Deepak Kr
Respected Contributor

Re: to change "from" field in mail

I dont remeber file in linux exactly but aliasing is possible.

We can send mail as if it is comming from a different domain.

"There is always some scope for improvement"
Heironimus
Honored Contributor

Re: to change "from" field in mail

What you want is called "address rewriting". The most common approach I've seen for sendmail is a genericstable. Your distribution may ship a default configuration that knows how to use a genericstable, or you may need to update the m4 and regenerate sendmail.cf.

It's a pretty common requirement. A google search for "address rewriting", "genericstable", and your distribution will probably provide some examples you can copy and modify.
Steven E. Protter
Exalted Contributor

Re: to change "from" field in mail

Shalom,

man mailx

This might get it out the door in a simple fast, correct way.

Otherwise you are looking at http://sendmail.org and learning sendmail the hard way.

Either /etc/aliases or /etc/mail/sendmail.mc genericstable and virtusertable.

Take a look here for how to compile a sendmail.cf file from a sendmail.mc file on HP-UX

http://www.hpux.ws/buildmail.hpux.text

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Paul Sperry
Honored Contributor

Re: to change "from" field in mail

look for this line in your sendmail.cf

# who I masquerade as (null for no masquerading) (see also $=M)

DMabc@company.com

and edit according. I thing you will have to stop and restart sendmail


Bill Hassell
Honored Contributor

Re: to change "from" field in mail

If you have the mailx program, just add the -r option. This will add a header that sets the return address, something like this:

mailx -r me@abcxyz.com -s "testing return" somebody@mycomputer.com < /some_file

mailx is standard on HP-UX.


Bill Hassell, sysadmin
kumar nishant
Occasional Contributor

Re: to change "from" field in mail

in spite of all the suggestion, i am not able to configure my linux server. all the key word given by you doesn't exist on sendmail.cf file.
Can any one tell me the location or keyword which need to be changed in sendmail.cf file or you can suggest me chenges ( if i need to include any line) in sendmail.mc file and guide me with the steps to map this file.

Regards,
Kumar Nishant
skt_skt
Honored Contributor

Re: to change "from" field in mail

"sendmail -f" which does the same magic
Bill Hassell
Honored Contributor

Re: to change "from" field in mail

sendmail -f and mailx -r both accomplish the same thing. There is no need to modify your sendmail.cf file. The man page for sendmail is helpful. Modifying sendmail.cf is only needed when you want every message to have a different return address.


Bill Hassell, sysadmin
kumar nishant
Occasional Contributor

Re: to change "from" field in mail

i got "-f" switch in sendmail but when i tried to send email through sendmail i receive massage but also i got one error message from system admin. i am not familiar with sendmail feature so can you please tell me how can i do "cc" and "bcc" using sendmail.

One more thing, can't i use "-f" option with mail or mailx command? i tried but got error (like use -c -s -b option).

Regards,
Kumar Nishant