Mailserver

<p>The Mailserver is defined in this guide as the system's core that sends/receives, stores, scans, and filters e-mail, as well as manages user/domain account data.</p> <h2>System overview</h2> <p>To understand how the mailserver operates, consider the following example where John Doe sends an email from his account at example.org (johndoe@example.org) to Jane Doe with an email account at example.info (janedoe@example.info):</p> <p><img src="https://user-images.githubusercontent.com/6718345/37560758-a4a322de-2a3e-11e8-8026-f462d11db358.png" alt="e-mail sequence" /></p> <h3>Sending sequence (example.org)</h3> <ol> <li>The mail client offers the email and the users credentials to the MTA.</li> <li>The MTA forwards the credentials to the MDA, which uses the credentials to see whether John is allowed to send emails from this server (i.e. is found in the database) and reports the result back to the MDA.</li> <li>The MTA resolves the "example.info" domain name using DNS to determine the ip-address of the mailserver being targeted.</li> <li>The MTA offers the email to the receiving MTA.</li> <li>The mail client sends the mail to MDA for storage.</li> </ol> <h3>Receiving sequence (example.info)</h3> <ol start="6"> <li>The MTA recieves the mail sent by the sending MTA.</li> <li>The MTA checks whether the mail is addressed to someone the MTA knows (i.e. the user / domain combination is found in the database).</li> <li>The mail is forwarded to the content control system.</li> <li>The content control system executes both a check on malicious content using a virus scanner, and a score check using a spamfilter.</li> <li>The result of the content check is returned to the MTA that writes the info into the email header.</li> <li>The mail is queued to the MDA for processing.</li> <li>The MDA uses a mail filter to determine where the mail should be stored.</li> <li>The MDA writes the mail to the designated location.</li> <li>The mail is delivered to the mail client (upon request of the mail client).</li> </ol> <h2>Subsystems</h2> <h3>Software components</h3> <ul> <li><a href="https://en.wikipedia.org/wiki/Email_client">Mail client</a>: is an email reader or, more formally, a 'mail user agent' (MUA). It is used by system users to access and manage their email.</li> <li><a href="https://en.wikipedia.org/wiki/Message_transfer_agent">MTA</a> (<a href="http://www.postfix.org/">Postfix</a>): is an email relay or, more formally, a 'mail transfer agent' (MTA). It is used in the system to transfer email messages from one computer to another.</li> <li><a href="https://en.wikipedia.org/wiki/Mail_delivery_agent">MDA</a> (<a href="https://www.dovecot.org/">Dovecot</a>): is a "postman" or, more formally, a 'mail delivery agent' (MDA). It is used in the system to deliver/retrieve emails to/from a local recipient's mailbox.</li> <li><a href="https://en.wikipedia.org/wiki/Database">Database</a> (<a href="https://mariadb.org/">MariaDB</a>): is a place to store information organized in schemas, tables, queries, reports, views, and other elements. It us used in the system to store user data.</li> <li><a href="https://en.wikipedia.org/wiki/Mail_filter">Mail filter</a> (<a href="http://sieve.info/">Sieve</a>): is an email processor. It is used in the system to automatically organize e-mails according to specified (user set) criteria.</li> <li><a href="https://en.wikipedia.org/wiki/Content-control_software">Content control</a> (<a href="https://www.amavis.org/">AMaViS)</a>: is the interface between the MTA and content filter engines. It is used in the system to either block suspicious emails or mark them with a spam score.</li> <li><a href="https://en.wikipedia.org/wiki/Antivirus_software">Virus scanner</a> (<a href="https://www.clamav.net/">ClamAV</a>): is a malicious software detector. It is used in the system to detect trojans, viruses, malware &amp; other threats.</li> <li><a href="https://en.wikipedia.org/wiki/Spam_assassin">Spam filter</a> (<a href="https://spamassassin.apache.org/">Spamassasin</a>): is a system to separate worthless (often undesired/bulk) emails from the valuable ones. It is used in the system to score emails on its undesirability.</li> <li><a href="https://en.wikipedia.org/wiki/Transport_Layer_Security">TLS/SSL</a> (<a href="https://en.wikipedia.org/wiki/Transport_Layer_Security#Digital_certificates">Certificates</a>): are Transport Layer Security (TLS) / Secure Sockets Layer (SSL) cryptographic protocols. They are used by the system to provide network communications security.</li> <li><a href="https://en.wikipedia.org/wiki/Email_box">Mailbox</a> (<a href="https://en.wikipedia.org/wiki/Directory_(computing)">directories</a>): storage. It is used in the system as the destination to which email messages are delivered (the equivalent of a letter box in the physical postal system).</li> </ul> <h3>Communication protocols</h3> <ul> <li><a href="https://en.wikipedia.org/wiki/User_Datagram_Protocol">SMTP</a>: The Simple Mail Transfer Protocol (SMTP) is an Internet standard for electronic mail (email) transmission.</li> <li><a href="https://en.wikipedia.org/wiki/Transmission_Control_Protocol">TCP</a>: The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite.</li> <li><a href="https://en.wikipedia.org/wiki/User_Datagram_Protocol">UDP</a>: The User Datagram Protocol (UDP) is one of the core members of the Internet protocol suite.</li> <li><a href="https://en.wikipedia.org/wiki/Unix_domain_socket">Socket</a>: Unix domain socket or IPC socket (inter-process communication socket) is a data communications endpoint for exchanging data between processes executing on the same host operating system.</li> <li><a href="https://en.wikipedia.org/wiki/SQL">SQL</a>: "sequel"; Structured Query Language is a language used in programming and designed for managing data held in a relational database management system (RDBMS).</li> <li><a href="https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol">IMAP</a>: the Internet Message Access Protocol (IMAP) is an Internet standard protocol used by e-mail clients to retrieve e-mail messages from a mail server over a TCP/IP connection.</li> <li><a href="https://en.wikipedia.org/wiki/Local_Mail_Transfer_Protocol">LMTP</a>: The Local Mail Transfer Protocol (LMTP) is an extension of the Simple Mail Transfer Protocol (SMTP). It is designed as an alternative to normal SMTP for situations where the receiving side does not have a mail queue, such as a mail storage server acting as a Mail Delivery Agent (MDA).</li> </ul> <!-- REFERENCES -->