LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 03-15-2012, 09:40 AM   #1
Oz.
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Rep: Reputation: Disabled
sendmail - Sending emails from the machine with name of the HOSTNAME


Hi,

In my server I work with sendmail, for a long time I try to send emails from user "root" and get this mail with full name of the HOSTNAME machine. but in the from I only see "root" and not root@myhostname.com, when I add the LOCAL_USER(`root')dnl to /etc/mail/submit.mc file, it's work i see the root@myhostname.com but if I try to send mail from user "root" like - echo "bla" | mail -s "test" root i get this error: "root... User address required"

in addition, I use a file ".forward"

anybody know as a problem and know the solution ?

If there is a solution with "aliases" file, I like to see an example...

Thanks, Oz.
 
Old 03-15-2012, 02:37 PM   #2
JSkywalker
Member
 
Registered: Aug 2007
Distribution: openSUSE 12.1
Posts: 96

Rep: Reputation: 24
http://www.linuxhomenetworking.com/w...x_Mail_Servers
the chapter "Using Sendmail to Change the Sender's Email Address " might be of interest....

or, kill sendmail, and stat using postfix
 
Old 03-18-2012, 03:08 AM   #3
Oz.
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Hi JSkywalker,
Thanks for the help...
it work's, but if I send mail from "root" user I get the mail from "root" and not from "root@e1.mydomain.com"
is there anything else you could recommend ?

thanks again,
Oren.

Last edited by Oz.; 03-19-2012 at 04:06 AM.
 
Old 03-18-2012, 09:18 AM   #4
agentbuzz
Member
 
Registered: Oct 2010
Location: Texas
Distribution: Debian, Ubuntu, CentOS, RHEL
Posts: 118

Rep: Reputation: 22
sendmail masquerading

Oz,
There is a useful explanation of masquerading written by Eric Himself(tm) here.
It sounds like you need to use EXPOSED_USER(`usernames') or EXPOSED_USER_FILE(`filename') in your sendmail.mc to ensure that the hostname is not masqueraded for system messages. You shouldn't need to mess with submit.mc. You might consider starting with a clean source tree and building a new sendmail.cf having modified only your sendmail.mc.

Here is an easy cheat sheet for building sendmail and its config files.
 
Old 03-19-2012, 04:05 AM   #5
Oz.
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
A quick question - I have noticed that system email arrive as sent from "root<root@e1.mydomain.com>", so in a way sendmail already adds the localhost.localdomain.
The problem is with the attached nickname (e.g. root<>), which makes it harder for us to read from cellular devices. Emails sent from other users arrive as sent from the raw address (e.g. "user@e1.wizaboo.com"). Do you have any idea how can we strip the nickname from the root user as well?
 
Old 03-19-2012, 12:04 PM   #6
agentbuzz
Member
 
Registered: Oct 2010
Location: Texas
Distribution: Debian, Ubuntu, CentOS, RHEL
Posts: 118

Rep: Reputation: 22
sendmail address re-writing

Oz,
You can use the genericstable to re-write local addresses, both "From:" addresses and envelope addresses, to anything you choose. First, make the needed changes to your sendmail.mc:
Code:
FEATURE(genericstable, hash /etc/mail/genericstable)
GENERICS_DOMAIN(SERVER1.domain.com)
FEATURE(masquerade_envelope)
Then, from the location in your sendmail source tree that has both the sendmail.mc and a copy of the "Build" script, do a "./Build sendmail.cf". That will build a valid sendmail.cf, which you can drop into /etc/mail. Make sure to back up your original /etc/mail/sendmail.cf first. Next, build the /etc/mail/genericstable. It will have entries like this:
Code:
root:  root@SERVER1.domain.com
postgres:  postgres@SERVER1.domain.com
Do the following to create the keyed database with the M4 macro processor:
Code:
makemap hash /etc/mail/genericstable.db < /etc/mail/genericstable
You have to restart sendmail now. Not so that it can read genericstable.db, but to get it to re-read sendmail.cf.

Do something that causes system messages to be generated. Your sender address and envelope address should be masqueraded to the same address.
 
Old 03-20-2012, 03:36 AM   #7
Oz.
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks,
I'll try to do it!

Thanks again
Oz.
 
  


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
[SOLVED] sendmail sometimes sending emails and sometimes not Majed17 Linux - Server 24 11-08-2011 05:24 AM
Sendmail: sending emails to Yahoo problem mikeressan Linux - Server 5 04-11-2011 08:54 PM
problem of sending out emails through sendmail -- error code 421 kkeith Linux - Newbie 1 06-30-2006 04:59 AM
sending/recieving emails with sendmail xushi Slackware 2 02-25-2004 04:44 PM
Sendmail not sending emails, errorlog hydro Linux - Software 8 06-20-2003 05:48 PM


All times are GMT -5. The time now is 09:30 AM.

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