-   Linux - Newbie (
-   -   Change sendmail's sender address (

rjo98 06-17-2010 02:10 PM

Change sendmail's sender address
We're using mutt to send out a daily email through cron. The only problem is that half the people aren't getting it, because its getting rejected as coming from an invalid address. Right now its sending out as username@localhost.localdomain.

How can I change this? I found the, which I believe previous people have been editing directly, which from what I read isn't the best way to configure sendmail.

Also, this is the first time i've actually tried to do anything with sendmail, so sorry if this is a real basic question.

rweaver 06-17-2010 02:40 PM

You want to add the features:

To your sendmail config

rjo98 06-17-2010 05:11 PM

Hi rweaver. Do I just VI the file and add those at the end?

rjo98 06-17-2010 09:13 PM

I looked in my and I do not have lines like that commented out, so if anyone can tell me how and where to add them, it would be greatly appreciated.

rjo98 06-18-2010 08:23 AM

or is there a switch i can use for mutt to have it use the sender address i want?

bathory 06-18-2010 08:48 AM


Originally Posted by rjo98 (Post 4007499)
or is there a switch i can use for mutt to have it use the sender address i want?

You can set the env. variable EMAIL before running mutt, e.g.

mutt -s "Subject" ...

BTW rweaver means is, that you have to use those features in your and then rebuild You can use google for tutorials about sendmail masquerading


rjo98 06-18-2010 08:52 AM

Hi Bathory, thanks for replying.

I tried to do what you said but it errors on the export line, saying "export: command not found". when i look in my /etc/passwd my account is set to /bin/tcsh if that might be the problem.

Also, using your solution once i get past that export error, do i need to modify the I think people have been directly modifying the .cf file rather than .mc so i'm afraid to regenerate the .cf.

rjo98 06-18-2010 08:56 AM

Wait, I think it worked, i just had to type bash, then enter the commands.

but if i wanted to cron this without changing the default shell for the user, do i just add a line that says bash before the two you provided, then finish it with a line stating exit?

bathory 06-18-2010 08:57 AM

Oops, export is used for the bash shell. In your case I guess you need setenv

setenv EMAIL
You don't modify directly. You modify and based on that you rebuild
It would be better use masquerade, but since you don't want to, then go with the EMAIL workaround


rjo98 06-18-2010 09:01 AM

I'm new to sendmail and have read you don't modify that file directly, but the people before me have, so i'm kinda hosed.

I'll try the sentenv too to see if that works.

bathory 06-18-2010 09:11 AM

There are little things you can modify directly in Most modifications are done through

Anyway if you are going to use mutt in cronjob, mind that cron's environment could be different that the user's whose cronjob is run. So you have to use a script to define the variable and run mutt.

rjo98 06-18-2010 09:12 AM

Looks like both options you gave me work in the two shells, so either way i think i should be set!! thanks a TON bathory.

rjo98 06-18-2010 11:21 AM

bad news, while it looks like its coming from the address, when i look at the header info its still coming from the generic stuff in my original post, so its getting rejected by outside sources.

any other thoughts?

bathory 06-18-2010 12:12 PM


Another workaround is to create a ~/.muttrc for the user that runs the cronjob, containing:

set envelope_from=yes
set from=""

Once again the best thing to do is masquerading, because the above workarounds are specific for mutt, so other programs like mail(x) are not going to work.

rjo98 06-18-2010 12:23 PM

we only use mutt to send the emails out, so i will try this and post back my results. thanks again bathory!!

All times are GMT -5. The time now is 12:46 AM.