SMTP/Email

SMTP, Simple Mail Transfer Protocol, is the mail protocol for TCP/IP based networks like the internet. By default it uses TCP port 25. SMTP uses MTA’s (Mail Trasfer Agents) like sendmail and postfix to deliver mail.

Wikipedia entry for SMTP

Clients
Mutt is a nice client for mailing attachments from the commandline. It does require a MTA like sendmail.

The command to send an attachment can be something like:

# echo “What you want to tell (message body)” | mutt -a <attachment> -s “Subject” user@domain

Without mutt is is also possible

# uuencode <file to send> <file to send> | mailx -s”Subject” user@domain

Own server on ISP network

Many ISP block direct access to customers port 25 for security reasons. If you do want to run your own email-server on an ISP network use the following configuration in your DNS zone-file.

@ 10800 IN MX 10 <yourserver>.<yourdomain>.
@ 10800 IN MX 20 <relayserver>.<ISPdomain>.

How does it work?

If an email-server wants to send email it looks op the MX-records for the domain of the intended receiver.  MX-records specify how mail is delivered to your domain. The 4th field give the priority of the mailserver on this line. The server with the lowest number is tried first. This line (with priority 10) specifies your own server. As most ISP block direct access to customer SMTP-ports (TCP port 25) your server is not reachable from an outside email server. The second priority is tried (having priority 20). This is the relay-server of your ISP, it can do spam and virus-checking. Because the ISP-relay-server is not configured to handle mail for your domain it will try to deliver it to the lowest priority MX-server again. As the ISP-mailserver is inside the ISP-network it can reach your emailserver and the email will be delivered to your server.

MailRelay

Forwarding

When using sendmail compatible mailservers users can easily forward mail to another place by putting a .forward file in their home-directory.

Example .forward lines (you can have more line in your .forward, all will be processed).

newreceiver@adomain.tld
Forward to this email address
|ascript.sh
Pipe to this script
/path/to/filename.txt
Append to this file

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.