17 December 2011

Sending email from a Debian Web Server


On a Debian server it uses Exim4 for the mailing server; if this is only outgoing mail that is the easiest and we'll just cover that here.  Ubuntu will work similar if it uses Exim4.  Redhat uses Sendmail and will have different setups.

On Debian:
shell#  dpkg-reconfigure exim4-config

Select these options:
Internet server, sending mail directly with SMTP
System Name: set this as whatever you want user@____.com to come from; this will also accept emails for users at that name
Listen to the needed IPs and/or machines
Don't relay, generally
DND Minimal set to No
Maildir format to prevent a single-point-of-failure
Split Config is generally set to No

Test at a command line with:
shell#  mail -s "Subject" yourname@realemail.com [enter]
something something
[ctrl][d]
[enter]
shell#

See current mail queue with:
shell#  mailq

Run current queue with:
shell#  runq

With a bit more manual setup, we can also accept user+tag@domain.com type emails.

0 comments: