Send-mails-from-debian-squeeze

From aldeid
Jump to navigation Jump to search

Description

Ever wanted to emails from your Debian box? This tutorial is for you...

Installation

# apt-get update
# apt-get upgrade
# apt-get install exim4-daemon-light mailutils

Configuration

Type of mail configuration

# dpkg-reconfigure exim4-config

Then configure as follows:

┌─────────────────────┤ Mail Server configuration ├─────────────────────┐
│ General type of mail configuration:                                   │ 
│                                                                       │ 
│     internet site; mail is sent and received directly using SMTP      │ 
│     mail sent by smarthost; received via SMTP or fetchmail            │ 
│     mail sent by smarthost; no local mail                             │ 
│     local delivery only; not on a network                             │ 
│     no configuration at this time                                     │ 
│                                                                       │ 
│                                                                       │ 
│                  <Ok>                      <Cancel>                   │ 
│                                                                       │ 
└───────────────────────────────────────────────────────────────────────┘

System mail name

┌───────────────────────┤ Mail Server configuration ├───────────────────────┐
│ The 'mail name' is the domain name used to 'qualify' mail addresses       │ 
│ without a domain name.                                                    │ 
│                                                                           │ 
│ This name will also be used by other programs. It should be the single,   │ 
│ fully qualified domain name (FQDN).                                       │ 
│                                                                           │ 
│ Thus, if a mail address on the local host is [email protected], the         │ 
│ correct value for this option would be example.org.                       │ 
│                                                                           │ 
│ This name won't appear on From: lines of outgoing messages if rewriting   │ 
│ is enabled.                                                               │ 
│                                                                           │ 
│ System mail name:                                                         │ 
│                                                                           │ 
│ aldeid.local_____________________________________________________________ │ 
│                                                                           │ 
│                    <Ok>                        <Cancel>                   │ 
│                                                                           │ 
└───────────────────────────────────────────────────────────────────────────┘ 

IP addresses to listen on

┌───────────────┤ Mail Server configuration ├───────────────┐
│ IP-addresses to listen on for incoming SMTP connections:  │ 
│                                                           │ 
│ 127.0.0.1________________________________________________ │ 
│                                                           │ 
│              <Ok>                  <Cancel>               │ 
│                                                           │ 
└───────────────────────────────────────────────────────────┘

List of recipient domains

┌───────────────────────┤ Mail Server configuration ├───────────────────────┐
│ Please enter a semicolon-separated list of recipient domains for which    │ 
│ this machine should consider itself the final destination. These domains  │ 
│ are commonly called 'local domains'. The local hostname (aldeid.aldeid)   │ 
│ and 'localhost' are always added to the list given here.                  │ 
│                                                                           │ 
│ By default all local domains will be treated identically. If both         │ 
│ a.example and b.example are local domains, [email protected] and              │ 
│ [email protected] will be delivered to the same final destination. If         │ 
│ different domain names should be treated differently, it is necessary to  │ 
│ edit the config files afterwards.                                         │ 
│                                                                           │ 
│ Other destinations for which mail is accepted:                            │ 
│                                                                           │ 
│ aldeid.aldeid; aldeid; localhost.localdomain; localhost__________________ │ 
│                                                                           │ 
│                    <Ok>                        <Cancel>                   │ 
│                                                                           │ 
└───────────────────────────────────────────────────────────────────────────┘ 

Domains to relay mail for

┌───────────────────────┤ Mail Server configuration ├───────────────────────┐
│ Please enter a semicolon-separated list of recipient domains for which    │ 
│ this system will relay mail, for example as a fallback MX or mail         │ 
│ gateway. This means that this system will accept mail for these domains   │ 
│ from anywhere on the Internet and deliver them according to local         │ 
│ delivery rules.                                                           │ 
│                                                                           │ 
│ Do not mention local domains here. Wildcards may be used.                 │ 
│                                                                           │ 
│ Domains to relay mail for:                                                │ 
│                                                                           │ 
│ _________________________________________________________________________ │ 
│                                                                           │ 
│                    <Ok>                        <Cancel>                   │ 
│                                                                           │ 
└───────────────────────────────────────────────────────────────────────────┘

Machines to relay mail for

┌───────────────────────┤ Mail Server configuration ├───────────────────────┐
│ Please enter a semicolon-separated list of IP address ranges for which    │ 
│ this system will unconditionally relay mail, functioning as a smarthost.  │ 
│                                                                           │ 
│ You should use the standard address/prefix format (e.g. 194.222.242.0/24  │ 
│ or 5f03:1200:836f::/48).                                                  │ 
│                                                                           │ 
│ If this system should not be a smarthost for any other host, leave this   │ 
│ list blank.                                                               │ 
│                                                                           │ 
│ Machines to relay mail for:                                               │ 
│                                                                           │ 
│ _________________________________________________________________________ │ 
│                                                                           │ 
│                    <Ok>                        <Cancel>                   │ 
│                                                                           │ 
└───────────────────────────────────────────────────────────────────────────┘

Keep number of DNS-queries minimal

┌─────────────┤ Mail Server configuration ├─────────────┐
│                                                       │ 
│ Keep number of DNS-queries minimal (Dial-on-Demand)?  │ 
│                                                       │ 
│              <Yes>                 <No>               │ 
│                                                       │ 
└───────────────────────────────────────────────────────┘

Delivery method for local mail

┌───────────────────────┤ Mail Server configuration ├───────────────────────┐
│ Exim is able to store locally delivered email in different formats. The   │ 
│ most commonly used ones are mbox and Maildir. mbox uses a single file     │ 
│ for the complete mail folder stored in /var/mail/. With Maildir format    │ 
│ every single message is stored in a separate file in ~/Maildir/.          │ 
│                                                                           │ 
│ Please note that most mail tools in Debian expect the local delivery      │ 
│ method to be mbox in their default.                                       │ 
│                                                                           │ 
│ Delivery method for local mail:                                           │ 
│                                                                           │ 
│                     mbox format in /var/mail/                             │ 
│                     Maildir format in home directory                      │ 
│                                                                           │ 
│                                                                           │ 
│                    <Ok>                        <Cancel>                   │ 
│                                                                           │ 
└───────────────────────────────────────────────────────────────────────────┘

Split configuration into small files?

┌───────────────────────┤ Mail Server configuration ├───────────────────────┐
│                                                                           │ 
│ The Debian exim4 packages can either use 'unsplit configuration', a       │ 
│ single monolithic file (/etc/exim4/exim4.conf.template) or 'split         │ 
│ configuration', where the actual Exim configuration files are built from  │ 
│ about 50 smaller files in /etc/exim4/conf.d/.                             │ 
│                                                                           │ 
│ Unsplit configuration is better suited for large modifications and is     │ 
│ generally more stable, whereas split configuration offers a comfortable   │ 
│ way to make smaller modifications but is more fragile and might break if  │ 
│ modified carelessly.                                                      │ 
│                                                                           │ 
│ A more detailed discussion of split and unsplit configuration can be      │ 
│ found in the Debian-specific README files in /usr/share/doc/exim4-base.   │ 
│                                                                           │ 
│ Split configuration into small files?                                     │ 
│                                                                           │ 
│                    <Yes>                       <No>                       │ 
│                                                                           │ 
└───────────────────────────────────────────────────────────────────────────┘

Test your configuration

# echo "This is just a test..." | mail -s "Just testing" [email protected]