Contents |
Install mailx. Example usage:
echo hi|mailx -s'hi' someone@somewhere.com
I have two servers in a setup:
server_A - the mail server running Postfix server_B - another server
I would like the internal mail of server_B to be forwarded to
server_A.
I install ssmtp on server_B, and configure it to
forward mail to server_A.
Edit /etc/ssmtp.conf:
root= mailhub=server_B
server_A must accept mail from server_B.
Edit /etc/postfix/main.cf and add server_B to
mydestination:
mydestination = ... server_B
Enter the following on server_B:
sendmail root from: server B hello.
... finish with CTRL+D.
My TDC ADSL connection blocks port 25, but the TDC website stated:
I set up my DNS to
mail.schmid.dk IN A [IP] schmid.dk IN MX 10 mail.schmid.dk schmid.dk IN MX 20 backup-mx.post.tele.dk
I also had to forward port 25 (SMTP - is forwarded from backup-mx.post.tele.dk) and port 993 (secure imap) to my server in my router setup.
# emerge openssl imap dovecot # rc-update add postfix default # rc-update add dovecot default
# vim /etc/postfix/main.cf myhostname = schmid.dk <- this determines the hostname accepted by mydomain = schmid.dk the mail server, e.g. you can't mail to myorigin = $mydomain schmid@mail.schmid.dk ... mydestination = $myhostname, mail.$mydomain, localhost <- ... unless you specify it here! relayhost = smtp.mail.dk <- this is the TDC requirement alias_database = hash:/etc/mail/aliases <- this is correct. the '.db'-extension is added alias_maps = hash:/etc/mail/aliases by postfix home_mailbox = .maildir/ # vim /etc/mail/aliases root: schmid operator: schmid jakob: schmid someuser: someuser@someother.address.com <- forward to other mail server # postalias /etc/mail/aliases # newaliases
# openssl genrsa -out privkey.pem 2048 # openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095 # mv cacert.pem /etc/ssl/certs/ # mv privkey.pem /etc/ssl/private/
# vim /etc/dovecot.conf protocols = imaps ssl_cert_file = /etc/ssl/certs/dovecot.pem ssl_key_file = /etc/ssl/private/dovecot.pem default_mail_env = maildir:%h/.maildir auth = default auth_mechanisms = plain <- we are already using SSL encryption when logging, so this is OK auth_userdb = passwd <- users in /etc/passwd auth_passdb = shadow <- passwords in /etc/shadow
Server Name: mail.schmid.dk Port: 993 User Name: schmid [x] use secure connection (SSL) [ ] use secure authentification