SMTP Notes

this file can be found at

The information on this page were configurations I needed to make on my local home server/desktops to send mail. The server has automated jobs and needs to contact/notify me when ever the scripts detects errors or issues that needs my attention. STMP normally works out of the box... but...

Due to ISP BLOCKING SMTP outbound port, to get "send" mail working from home
-- need to relay it with, for example, google's smtp servers.

[ /etc/hostname and /etc/mailname ] can be "internal" hostnames
	i.e. does not need to be accessible from external networks
Note: if ISP was not blocking SMTP port, then hostname will need to be "valid".
Many SMTP relay and end points will try to verify From: address to help curb spamming.
USE << ALT >> EMAIL ACCT while configuring login/passwd for relay
-- again, this should be a << secondary >> account
	passwords are written in the [ CLEAR ] in these config files
	--- so yes, email will come "from" this alt acct ---
	[ prevent accidental primary account exposure when doing
	  things like tar'ing folder for archival purposes ]
Remember, this is for automated notifications, so using an alternate email account can help give messages instant recognisability that may require immediate attention.


send a test msg (or use "email verification" mode):
	echo "msg body" | mail -s "msg subj"

if things still bomb, make sure to look at log files:
	sendmail -bv		# "email verification": ACL test - does not go in any inbox
	cat /var/log/mail.log | tail -20


just follow these instructions: (pretty much works right out of the box)
- no need to do any thing with the [ /etc/exim4/passwd.client ] file
  as some of the comments alluded to...

handy commands while testing:
	sudo mailq                                    # show mail queue
	sudo exiqgrep -z -i | sudo xargs exim -Mrm    # nuke all msgs in queue


first, the following may be needed: nuke existing postfix install
and re-install it to start with a clean slate.
	- sudo apt-get purge postfix
	- sudo aptitude install postfix
	- sudo dpkg-reconfigure postfix

then follow up with this link:
- jump down to section 3: ( generating certs )
- these will be used to build some dummy SSL certs
- follow instructions to 4.10: ( common postfix commands )
  by now, a few pem files were created and copied into the postfix folder
  [ SSL + SASL ]...  a few [ postmap ] hash files are also created...
  and [ ] has a bunch of additions.
- don't forget to setup services startup and shutdown links:
	cd /etc/rc3.d
	sudo ln -s ../init.d/postfix S80postfix
	sudo ln -s ../init.d/postfix K80postfix
	cd /etc/rc5.d
	sudo ln -s ../init.d/postfix S80postfix
	sudo ln -s ../init.d/postfix K80postfix

NOTE! to make TLS work properly:
append the following certs to [ cacert.pem ]:
	Thawte_Premium_Server_CA & Equifax_Secure_CA

handy commands while testing:
	mailq                    # show mail queue
	sudo postsuper -d ALL    # nuke all msgs in queue

more resources:


currently, am not running sendmail... will revisit this when sendmail makes a comeback...

after editing /etc/aliases, run the command:
	newaliases                  # sendmail
	postaliases /etc/aliases    # postfix
	                    # exit

# --- start of example entries in /etc/aliases ---
# simple aliases to an address
root: johndoe, johndoe@domain.tld
john: johndoe@another.domain.tld, johndoe@some.where.else

# example of a mailing list in aliases file
the_project: john, jane,
# but, use an external file to keep mailing lists under control...

# send mail to address, addresses in a file and to a file
announce: johndoe, :include: /etc/Exim/staff,

# target can be piped to a command
majordomo:  "|/usr/mail/majordomo ..."
autohelp:	"|/usr/etc/autohelp ..."
ppp-list:	"|/usr/local/bin/gateit local.lists.ppp"
# --- end of examples ---

example email list from the [ :include: ] directive
# --- start example /etc/Exim/staff ---
# --- end example /etc/Exim/staff ---

Copyright © 2010 by Nick Shin. All Rights Reserved.
These pages are designed by ESTSS.