Difference between revisions of "Linux mail forward"

From John Freier
Jump to: navigation, search
(Send a sample mail)
 
(4 intermediate revisions by the same user not shown)
Line 4: Line 4:
  
 
Go to the last line in the file (shortcut key 'G') and add the new email address.
 
Go to the last line in the file (shortcut key 'G') and add the new email address.
 
Before I started these commands I needed to install m4 and sendmail-cf
 
yum install m4
 
yum install sendmail-cf
 
 
Also mail didnt come with fedora 13 so I needed to install it
 
yum install mailx
 
 
  
 
  # Person who should get root's mail
 
  # Person who should get root's mail
Line 19: Line 11:
 
== Set up the domain ==
 
== Set up the domain ==
 
This is to setup the domain so it doesn't send mail from localhost.localdomain
 
This is to setup the domain so it doesn't send mail from localhost.localdomain
 +
 +
Make sure you do a back up, '''I have not got this to work yet.'''
 +
 +
Before I started these commands I needed to install m4 and sendmail-cf
 +
yum install m4
 +
yum install sendmail-cf
 +
 +
Also mail didnt come with fedora 13 so I needed to install it
 +
yum insatll mailx
  
 
1. Edit sendmail config
 
1. Edit sendmail config
Line 32: Line 33:
 
  # m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
 
  # m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
 
  # /etc/init.d/sendmail restart
 
  # /etc/init.d/sendmail restart
 +
 +
Sources
 +
[http://www.cyberciti.biz/tips/sendmail-masquerading-configuration-howto.html]
 +
[http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch21_:_Configuring_Linux_Mail_Servers]
 +
 +
== Send a sample mail ==
 +
If you need to install mail, it does not come with fedora
 +
yum install mailx
 +
 +
To start the message type:
 +
# mail -s “Hello world” {user}
 +
 +
When you press enter you can type the rest of the email.
 +
Ctrl+D ends the email and sends it.
 +
Ctrl+D
 +
 +
Sources
 +
[http://www.simplehelp.net/2008/12/01/how-to-send-email-from-the-linux-command-line/]
 +
 +
If mailx stops working...
 +
1.  yum install postfix
 +
 +
2. service postfix restart
 +
 +
== Hack Domain sendmail.cf ==
 +
This is a ok hack I guess?
 +
vi sendmail.cf
 +
 +
search for
 +
Dj$w.FOO.COM
 +
 +
and change it too
 +
Dj$w.johnfreier.com
 +
 +
it will change the send address from root@localhost.johnfreier.com

Latest revision as of 10:13, 21 July 2015

This will forward roots mail. Edit the aliases file.

vi /etc/aliases

Go to the last line in the file (shortcut key 'G') and add the new email address.

# Person who should get root's mail
root:           root, freier@gmail.com


Set up the domain

This is to setup the domain so it doesn't send mail from localhost.localdomain

Make sure you do a back up, I have not got this to work yet.

Before I started these commands I needed to install m4 and sendmail-cf

yum install m4
yum install sendmail-cf

Also mail didnt come with fedora 13 so I needed to install it

yum insatll mailx

1. Edit sendmail config

# vi /etc/mail/sendmail.mc

2. Append/add/modify the lines as follows:

MASQUERADE_AS(cyberciti.biz)dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(cyberciti.biz)dnl

3. Save and close the file. Replace domain name cyberciti.biz with your actual domain name. Update and restat sendmail server:

# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
# /etc/init.d/sendmail restart

Sources [1] [2]

Send a sample mail

If you need to install mail, it does not come with fedora

yum install mailx

To start the message type:

# mail -s “Hello world” {user}

When you press enter you can type the rest of the email. Ctrl+D ends the email and sends it.

Ctrl+D

Sources [3]

If mailx stops working... 1. yum install postfix

2. service postfix restart

Hack Domain sendmail.cf

This is a ok hack I guess?

vi sendmail.cf

search for

Dj$w.FOO.COM

and change it too

Dj$w.johnfreier.com

it will change the send address from root@localhost.johnfreier.com