Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 02-25-2008, 10:47 PM   #1
LQ Newbie
Registered: Apr 2004
Distribution: Fedora Core 5
Posts: 23

Rep: Reputation: 15
Forward local mail to another local host using sendmail


I would like to setup sendmail to forward mail on a linux server to another linux server which is running our mail services. I have root mail on this server which I would like to send to the mail server.

Can anyone suggest a howto or a path to achieve what I am after?

Many thanks,
Old 02-25-2008, 11:59 PM   #2
LQ Newbie
Registered: Nov 2005
Posts: 10

Rep: Reputation: 0
have you looked at modifying /etc/aliases ?
Old 02-26-2008, 12:29 AM   #3
Registered: May 2006
Posts: 89

Rep: Reputation: 15
Forward local mail to another local host using sendmail

PLease describe it more clearly

Explain what exactly you want to do . I am working on mail servers since quite a long. I can surely help you out.

But you need to explain it in more detailed form.
Old 02-26-2008, 08:36 AM   #4
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Rep: Reputation: 30
If all you want is root mail to be sent to another account. Assuming you do not already have a dot forward file in roots home.

#cd ~root && touch .forward
#echo emailaddres@domain.wherever >> .forward
#echo "test forward" | mail root@localhost
An email should now be in the account specified above.

If you want to have all mail forwarded to a different mail gateway then you need to uncomment and change the following line within /etc/mail/ (assuming RH or variant)

define(`SMART_HOST', `add your email gateway here')dnl

#make -C /etc/mail/
#service sendmail restart
#tail -f /var/log/maillog
Should get you started.


Last edited by lord-fu; 02-26-2008 at 08:37 AM. Reason: gave an asumption clause
Old 02-26-2008, 05:15 PM   #5
LQ Newbie
Registered: Apr 2004
Distribution: Fedora Core 5
Posts: 23

Original Poster
Rep: Reputation: 15
Thumbs up

I used the smart host and the .forward file to send the mail to postmaster on my other machine.

I also had to fixup the fqdn of the machine so the mail server didn't complain about it having no resolvable domain name.

Thanks for your help and sorry for my lack of explanation regarding what I wanted to do!
Old 02-26-2008, 05:38 PM   #6
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
As per post 2, the usual (and simplest way) would be to modify /etc/aliases.

You will see that there is already an entry near the bottom that I think looks like

#root: marc

And all you do is uncomment the line and change the target, so it looks like

root: user@another.machine

then run newaliases


forward, sendmail

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
exim4 forward all local mail? mpapet Linux - Newbie 1 12-08-2006 03:12 AM
exim4 forward all local mail? mpapet Linux - Networking 2 12-08-2006 02:34 AM
Postfix: Need to deliver all local mail to 1 account, then forward OneBinary Linux - Software 3 01-05-2006 04:49 PM
Sendmail and the local-host-names file vpatton Linux - Software 5 04-26-2004 07:37 PM
can't makemap local-host-names in sendmail TomHodder Linux - Software 2 09-09-2003 09:21 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:37 AM.

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