Article overview

Help article

DirectAdmin Tutorial Series 6: E-mail

This is the sixth part of our DirectAdmin Tutorial Series. If you are planning a new VPS, then we recommend starting with part 1 and to not skip any parts.

In order to send and receive an email with your domain, DirectAdmin uses Exim and Dovecot respectively as an outgoing and incoming email server. DirectAdmin automatically protects your email with TLS 1.2.

In this part we discuss the following topics:

  • Setting up reverse DNS
  • Adjusting the email limit
  • Creating an email address
  • SSL / TLS on mail for multiple domains (SNI)
  • Logging in to the webmail
  • General settings for use in email software
  • Spam protection

On a new VPS your email ports are closed for security reasons. Reverse DNS must be configured for your VPS before you can open them. You will also have to successfully pay an invoice from your account. Please note: a standard period of 17 days applies for the latter.

After setting up reverse DNS, you can ask our support department to open the ports manually. They will make a consideration and possibly open the gates at an accelerated rate.


Setting Reverse DNS

 

To prevent your mail from being stopped as spam, set reverse DNS for the IP addresses of your VPS. More information about reverse DNS can be found in our reverse DNS article. Follow these steps to set up reverse DNS:

 

Step 1

Go to the Blade VPS / VPS & Colocation page inside the control panel.


 

Step 2

Click the name of your VPS or colocation, and then click ‘Manage’ > 'Network information'.

control panel vps manage network information


 

Step 3

Click on the IP address of which you want to set the reverse DNS.

cp vps network information


 

Step 4

Enter the desired reverse DNS name and click ‘Modify reverse DNS’ to save it.

vps modify reverse dns


 

Step 5

Next, set up DNS records for your chosen reverse DNS in your DNS records. For example, in the screenshot above there are 4 IP addresses for which you would create the following records in your DNS settings.

reverse dns example

If you also use the IPs for which you set up reverse DNS for the root (@) of your domain, you can use CNAME records as shown below.

reverse dns cname

When entering the reverse DNS, preferably choose the hostname of your VPS or the domain from which you send mail: for example, server.yourdomainname.com or mail.yourdomainname.com.


Adjusting the email limit

 

A new installation of DirectAdmin has a limit on sending emails of 200 emails per day. This limit is set to prevent spam. If you send newsletters, for example, you likely need a higher limit soon. You adjust this limit as follows:

 

Step 1

Log in to DirectAdmin as the 'admin' user and click 'Administrator Settings' under 'Extra features'.

DirectAdmin admin settings


 

Step 2

Scroll down and adjust the limit under 'Email' as desired. Then click 'Save' to save your changes.

DirectAdmin change mail limit

Please note that a distinction is made between the DirectAdmin User account for which an email address is automatically created, and the limit per email address of email addresses that are not linked to a user within DirectAdmin.


Creating an email address

 

The email address yourusername@yourdomainname.com has been automatically created. For this manual, we use the user 'admin' and the supporttest.nl domain.

This means that in our example, DirectAdmin has already created admin@supporttest.nl. You are free to create as many email addresses as you want, but do not forget to create the email addresses you entered at Fail2ban in Chapter 2.

 

Step 1

Log in to DirectAdmin and navigate to the 'User Level' (if you're an admin or reseller). Click 'Email Accounts' under 'Email Management'.

DirectAdmin email accounts


 

Step 2

Next, click 'Create mail account'.

DirectAdmin create email address


 

Step 3

Then create the email address. You can set a limit here for the maximum size and amount of emails per day. To prevent your customers from intentionally or unintentionally sending spam, we recommend using this option.

DirectAdmin create mail address


DirectAdmin automatically creates the email address for the logged-in user. The log-in name for the webmail and the configuring of your email address in email software is for the logged-in user the username and not the actual email address!

Every email address that you create actually uses the email address as the login name. See the screenshot below for an example.

DirectAdmin mail login


SSL / TLS on mail for multiple domains (SNI)

 

If you use email on your DirectAdmin VPS for multiple domains (i.e., domains that do not match the domain that you use for your hostname), you must enable SNI for email. SNI allows you to apply SSL to multiple domains, instead of just on your hostname.

We have included the instruction below as of May 2018 in our DirectAdmin image. This instruction therefore only applies to installations from before May 2018, or if you use your own DirectAdmin license. A reinstallation of your VPS with our DirectAdmin image automatically uses the options below.

SNI is enabled by default for your website, but the DirectAdmin installation does not automatically have this enabled for email and uses an outdated version of exim.conf (Exim handles outgoing mail). The steps below allow you to apply SSL/TLS to mail for all domains on your VPS.

 

Step 1

Connect to your VPS via SSH or the VPS console and open directadmin.conf:

sudo nano /usr/local/directadmin/conf/directadmin.conf

 

Step 2

Add the following line to the file and then close and save the file with ctrl + X > Y > enter.

mail_sni=1

 

Step 3

Restart DirectAdmin to process the changes.

systemctl restart directadmin

 

Step 4

Run the following commands consecutively to update Exim and the Exim configuration file, so that Exim can use SNI for email (Dovecot can do that immediately after adding mail_sni=1).

cd /usr/local/directadmin/custombuild
./build update
./build set exim yes
./build set eximconf yes
./build set eximconf_release 4.5
./build set spamassassin yes
./build update
./build exim
./build exim_conf

Logging in to the webmail

 

DirectAdmin uses Roundcube as a webmail server. You can use the webmail immediately after creating your email address by logging in to 'yourdomain.com/roundcube'. You use your email address and the password you created in the previous section to log in.

RoundCube

If your username (e.g. admin) is the same as the name of your email address (e.g. admin@example.com), you can only log in with the username (e.g. admin) and not with the name of your full email address (e.g. admin@example.com).

The use of the webmail itself falls outside the scope of this manual.


Optional: using mail.yourdomain.com for the webmail

It is a personal preference whether you want to use your webmail on yourdomain.com/roundcube or mail.yourdomain.com. The yourdomain.com/roundcube option works automatically. To use mail.yourdomain.com you go through the following steps:

 

Step 1

A DNS record is required for mail.yourdomain.com. By using a CNAME record with the @ value (see chapter 4), you tell the DNS system that your subdomain uses the same IPv4 and IPv6 address as in the A and AAAA record of your domain itself.


 

Step 2

Within DirectAdmin itself you also create the subdomain so, for example, a folder is created on the FTP server. Log in to DirectAdmin at 'User Level' and click 'Your Account' under 'Subdomain Management'.

DirectAdmin subdomain management


 

Step 3

Enter 'mail' after 'Add Sub-Domain' and click 'Create'.

DirectAdmin create subdomain


 

Step 4

Create a text file on your computer with the name .htaccess.txt and the following content:

Redirect 301 yourdomain.com/roundcube

Replace yourdomain.com with the actual name of your domain.


 

Step 5

Connect to FTPS with your VPS (see chapter 5 under 'FTPS') and navigate to public_html > mail on your VPS.


 

Step 6

Upload the file .htaccess.txt to the 'mail' folder. Then click the file with the right mouse button and select 'Rename'. Remove .txt from the name so that the name is now .htaccess


General settings for use in email software

 

You probably want to use your email address in an app, email software, or to send emails from your website. For this, the settings are the same in all cases:

Incoming email (IMAP)

  • Server: mail.yourdomain.com
  • Port: 993
  • SSL: enabled
  • Username: your email address
  • Password: the password that you have set for this email address

Incoming email (POP3)

  • Server: mail.yourdomain.com
  • Port: 995
  • SSL: enabled
  • Username: your email address
  • Password: the password that you have set for this email address

Outgoing email (SMTP)

  • Server: mail.yourdomain.com
  • Port: 465
  • SSL: enabled
  • Username: your email address
  • Password: the password that you have set for this email address
  • Replace yourdomain.com by your actual domain name.
     
  • Your username is the same if the name is also a DirectAdmin user (e.g. admin in admin@supporttest.com), see 'Create an email address'.
     
  • Do you use Windows mail? Then choose the option 'Other account'.

Spam protection

 

DirectAdmin comes with SpamAssassin anti-spam software by default to protect your email against spam. SpamAssassin, however, is disabled by default until you switch it on. Follow the steps below to enable SpamAssassin and adjust some settings:

 

Step 1

Log in to DirectAdmin at 'User Level' and click 'SpamAssassin Setup' under 'Email Management'.

DirectAdmin spamassassin setup


 

Step 2

You will now see an overview of general SpamAssassin settings. Adjust these as desired, or leave the settings as they are, and then click 'Save' to switch on SpamAssassin.

DirectAdmin spamassassin configuration

  • Where do you want the spam to go: By default, email marked as spam goes to the inbox. You can adjust this to have spam actually end up in the spam box, for example.
  • What score threshold do you wish to use: This defines how strictly SpamAssassin checks mail.
  • Would you like to delete high scoring spam: With this option, you can make sure that if SpamAssassin is certain an email is spam, that spam is removed immediately. The spam email will not even be included in your spam folder.
  • Do you wish to rewrite the subject of a spam email: This option is useful if you want spam to be sent to your inbox. You can then have a prefix added to the subject of an email, in order to get a clearer insight into what is and is not considered as spam.
  • How should the spam be delivered: To prevent spam scripts from being executed, spam messages are sent as an attachment in a separate message by default.

 

Your email address (es) is now available for friends, family, and customers (and the rest of the world)! proceed to the next section ‘Part 7: Additional articles and other questions' for some final tips.

Should you have any questions left regarding this article, do not hesitate to contact our support department. You can reach them via the ‘Contact Us’ button at the bottom of this page.

If you want to discuss this article with other users, please leave a message under 'Comments'.

Has this article been helpful?

Create an account or log in to leave a rating.

Comments

Create an account or log in to be able to leave a comment.