Newer
Older
invertedlogic / Scripts / setup_mail.sh
#!/bin/bash

if [ ! "$UID" = "0" ]
then
   echo "This script requires being run as root, eg: \$ sudo $0"
   exit
fi

apt-get install bsd-mailx postfix

# Setup postfix so that sending mail works
mkfifo /var/spool/postfix/public/pickup
cat > /etc/aliases << EOF
# See man 5 aliases for format
postmaster:    root
EOF
cat > /etc/mailname << EOF
invertedlogic.com
EOF
cat > /etc/postfix/main.cf << EOF
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
smtpd_banner = $$myhostname ESMTP $$mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
myorigin = /etc/mailname
mydestination = localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 192.168.0.0/24
mailbox_size_limit = 51200000
recipient_delimiter =
inet_interfaces = all
inet_protocols = ipv4
EOF
/etc/init.d/postfix restart

#
# If above for setting up postfix didn't work then do following:
#
# Run:
#    dpkg-reconfigure postfix
#
# Answer with following:
#    Type:                  		"Internet Site"
#    System mail name:      		"invertedlogic.com"
#    Postmaster:            		"postmaster"
#    Other destinations:	 	"localhost.localdomain, localhost"
#    Force synchronous updates:		"Yes"
#    Local networks:               	"127.0.0.0/8 192.168.0.0/24"
#    Mailbox size limit (bytes):   	"51200000"
#    Local address extension character: ""
#    Internet protocols to use:   	"ipv4"
#