LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 06-17-2010, 02:10 PM   #1
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,397

Rep: Reputation: 36
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 sendmail.cf, 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.
 
Old 06-17-2010, 02:40 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 163Reputation: 163
You want to add the features:
MASQUERADE_AS(`hostname.domain.tld')
and
FEATURE(`masquerade_envelope')

To your sendmail config
 
Old 06-17-2010, 05:11 PM   #3
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,397

Original Poster
Rep: Reputation: 36
Hi rweaver. Do I just VI the file and add those at the end?
 
Old 06-17-2010, 09:13 PM   #4
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,397

Original Poster
Rep: Reputation: 36
I looked in my sendmail.cf 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.
 
Old 06-18-2010, 08:23 AM   #5
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,397

Original Poster
Rep: Reputation: 36
or is there a switch i can use for mutt to have it use the sender address i want?
 
Old 06-18-2010, 08:48 AM   #6
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,895

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Quote:
Originally Posted by rjo98 View Post
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.
Code:
export EMAIL=me@mydomain.com
mutt -s "Subject" recipient@domain.com ...
BTW rweaver means is, that you have to use those features in your sendmail.mc and then rebuild sendmail.cf. You can use google for tutorials about sendmail masquerading

Regards
 
Old 06-18-2010, 08:52 AM   #7
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,397

Original Poster
Rep: Reputation: 36
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 sendmail.cf? I think people have been directly modifying the .cf file rather than .mc so i'm afraid to regenerate the .cf.
 
Old 06-18-2010, 08:56 AM   #8
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,397

Original Poster
Rep: Reputation: 36
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?
 
Old 06-18-2010, 08:57 AM   #9
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,895

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Oops, export is used for the bash shell. In your case I guess you need setenv
Code:
setenv EMAIL my@mydomain.com
You don't modify sendmail.cf directly. You modify sendmail.mc and based on that you rebuild sendmail.cf.
It would be better use masquerade, but since you don't want to, then go with the EMAIL workaround

Regards
 
Old 06-18-2010, 09:01 AM   #10
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,397

Original Poster
Rep: Reputation: 36
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.
 
Old 06-18-2010, 09:11 AM   #11
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,895

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
There are little things you can modify directly in sendmail.cf. Most modifications are done through sendmail.mc

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.
 
Old 06-18-2010, 09:12 AM   #12
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,397

Original Poster
Rep: Reputation: 36
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.
 
Old 06-18-2010, 11:21 AM   #13
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,397

Original Poster
Rep: Reputation: 36
Unhappy

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?
 
Old 06-18-2010, 12:12 PM   #14
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,895

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Hi,

Another workaround is to create a ~/.muttrc for the user that runs the cronjob, containing:
Code:
set envelope_from=yes 
set from="me@mydomain.com"
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.
 
1 members found this post helpful.
Old 06-18-2010, 12:23 PM   #15
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,397

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change sender address of outgoing emails in Sendmail ALInux Linux - Server 8 05-10-2012 06:25 PM
sendmail sender address nasim2 Linux - Distributions 1 10-27-2009 04:14 AM
Set sender address with /bin/mail philosophia Programming 1 02-06-2008 09:59 PM
qmail: how can I block emails which have no sender address? hamish Linux - Networking 0 08-16-2006 04:16 PM
Sendmail's Return Address VIP3R Linux - Software 5 12-28-2003 11:40 PM


All times are GMT -5. The time now is 01:24 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration