LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Forward local mail to another local host using sendmail (https://www.linuxquestions.org/questions/linux-server-73/forward-local-mail-to-another-local-host-using-sendmail-623840/)

loopy69 02-25-2008 10:47 PM

Forward local mail to another local host using sendmail
 
Hi,

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,
Brett

chingadero 02-25-2008 11:59 PM

have you looked at modifying /etc/aliases ?

vedang 02-26-2008 12:29 AM

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.

lord-fu 02-26-2008 08:36 AM

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.

Code:

#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/sendmail.mc (assuming RH or variant)

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

Then
Code:

#make -C /etc/mail/
#service sendmail restart
#tail -f /var/log/maillog

Should get you started.

hth

loopy69 02-26-2008 05:15 PM

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!
Brett

billymayday 02-26-2008 05:38 PM

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


All times are GMT -5. The time now is 06:58 PM.