====== Email Security ======

In order to prevent one's emails from being labeled as SPAM, or worse, rejected, one can setup email security through a DNS. More and more Servers are starting to reject email that is not being secured to prove that it has come from a reliable source and not some spammer. This section will walk through the steps of securing your email server. 

//Note: This section assumes one owns a domain name and that domain name is the name to be used for one's BBS. If one uses synchro.net for emailing purposes, this will not apply in that case.//

==== Dynamic IP Address - No problem ====
  - Find a Dynamic Domain Server (DDNS) provider
    - There are many out there. There are even some free ones that will give at least one address which is all that is needed
    - This provider should provide directions on this initial setup
  - Setup an "A" record with whatever name is appropriate
    - This name won't be visible and serves as just a target for one's owned domain name to point to
  - Next step is to setup records on the owned Domain Name

==== Domain Name Records Setup ====
  - Log into one's provider of the domain name
  - Create an "A" record for the owned domain name
  - Create a "CNAME" record with the host name as one's BBS name or something else if prefered (i.e. this will be the address of one's BBS)
    - This should point to the address created in the DDNS provider
  - Create another "CNAME" record with the host name as 'mail' or some name that signifies it will be the name of the SMTP address
    - This should also point to the address created in the DDNS provider
  - Create a "MX" record and the host name should be the "@" symbol
    - This should point to the 'CNAME' in step 4
  - Next is to setup the "TXT" records that make the email being served more secure

==== Creating the 'TXT' records for security ====
  - Still logged into one's provider of the owned domain name, create a "TXT" record (i.e. This will be the SPF((Sender Policy Framework)) record)
    - The host name should be the "@" symbol
    - The TXT Value will contain the information that will state which domain names and IPs are OK if email comes from one of those. One will want to include all possible Domain Name/IP addresses that could serve up email. This part takes a little more effort to get the text right. Thankfully there are free tools available on the internet that will generate the SPF text for you. These are a couple of those sites.
      - http://web.archive.org/web/20241126225218/https://www.spfwizard.net/
      - https://www.dmarcanalyzer.com/spf/spf-record-generator/ (shows how to create an SPF record manually)
  - Create another "TXT" record (i.e. This will be the DMARC((Domain-based Message Authentication, Reporting, and Conformance)) record)
    - The host name for this record has to be _dmarc
    - The value specifies where to send reports of abuse of one's domain name.
    - There is an online tool to help with the creation of the value of this record:
      - https://dmarcian.com/dmarc-record-wizard/ (there could be other's, this was just the first one I found)
  - Create yet another "TXT" record (this is the final one and it is the DKIM((Domain Keys Identified Mail)) record)
    - This record will allow for the verification of the signage on the email that is placed by the MTA((Mail Transport Agent)) using a private key and the DKIM record has the public key. Thus emails can be verified against the DNS record.
    - **Note:** DKIM signing of outbound mail is available in Synchronet (v3.22 and later), on both Unix-like and Windows builds; see the [[server:mail#dkim_signing|DKIM Signing]] section of the Mail Server page for setup.
      - Having all three records (SPF, DMARC, and DKIM) helps prevent your outgoing email from being marked as junk/spam mail.

=== Validation Check ===
  * There are a couple of sites that can help with validating that the records are setup correctly:
    * https://mxtoolbox.com/MXLookup.aspx (Click the 'MX Lookup' button, then click the 'Find Problems' button)
    * https://www.dmarcanalyzer.com/spf/checker/ (under tools menu one can select dmarc also)
  * Check for any errors and correct them. If most every check turns up 'Green', then the records should be correct.
    * //Note: If your SPF record doesn't have an Domain Name/IP address that is used in delivering the email, the email will still be flagged as junk/spam//


===== See Also =====
  * [[:howto:|howto index]]
  * [[:server:mail:|Mail Server]]

{{tag>}}
