How to configure iPhone "Mail"

To add an email account into your iPhone's "Mail" app:

  1. Open the "Settings" app » "Accounts & Passwords" » Add Account » "Other" » Add Mail Account

  2. Enter the name, full** user@domain.com** email, password, and a short description. Click "Next".

  3. Assuming you're using IMAP, stay on this tab. For the "Incoming Mail Server", enter

Host Name: mail.domain.com
User Name: user@domain.com
1
2

and your password.

  1. For "Outgoing Mail Server", use the exact same settings you used for the Incoming Mail Server (hostname, username password). Note that the outgoing password is not optional, so you must enter it.

  2. On the next page, ensure "Mail" is enabled, and click "Save".

  3. It's important to confirm the SSL options are enabled. On the "Accounts & Password" page, click your user@domain.com account. It might only show your description, with "Mail" underneath, depending on what you typed. Then click the "Account: user@domain.com"

  4. First we confirm SSL for SMTP in the "Outgoing Mail Server" section, click "SMTP user@domain.com" » primary server: mail.domain.com. Once viewing the detailed SMTP server settings, ensure the 'use SSL' option is enabled:

Use SSL: ON
1

The "Authentication" setting should be set to "Password", and the Server Port set to 587.

  1. Next we confirm the IMAP settings, so go back so that you're viewing the "Account" page, and at the bottom, there is a link by itself labeled "Advanced". Click it.

  2. Inside the "Advanced" page, scroll down until you see the "Incoming Settings". We want to see:

Use SSL:	ON
Authentication:	Password
IMAP Path Prefix:	/
Server Port:	993
1
2
3
4

How to configure Thunderbird email client

To add an email account in Thunderbird:

  1. Open Tools » Account Settings » Account Actions » Add Mail Account

  2. Fill in the name, full email address (user@domain.com) and password), click Continue.

  3. Thunderbird will try and figure it out, but manual settings are usually needed. Click Manual config

  4. Set options:

Incoming:IMAPPort:993SSL:SSL/TLSAuth:Normal password
Outgoing:SMTPPort:587SSL:STARTTLSAuth:Normal password
UsernameIncoming:user@domain.comOutgoing:user@domain.com

For the imap/smtp server, use the value your host gives you. It might be mail.domain.com, but could also be the server.hostname.com, depending on how they've setup their SSL certificates. If you do get ssl certificate warnings, just accept them. The connection is likely still secure, as the value in the certificate might not match the server setting used (not a major issue).

  1. Click Done as re-test does not work for this case.

How to configure Gmail mail.google.com

Using the https://mail.google.comopen in new window website, to pull emails to your Gmail account using POP:

  1. Login to the https://mail.google.com website and Click the Setting cog, top right » settings » Accounts and Import

  2. "Check mail from other accounts", click "Add a mail account"

  3. In the new window, type in your full user@domain.com email, click "Next"

  4. Use the "Import email from my other account (POP3)", click "Next"

  5. On the "Enter the mail settings for user@domain.com", use values:

Option nameValue
Usernameuser@domain.com
Passwordyoursecretpass
POP Servermail.domain.com
Port995
Always use a secure connection (SSL) when retrieving mailON

then click "Add Account"

  1. It might ask "Would you also like to be able to send mail as user@domain.com?". For this question, if you want mail to leave from your DirectAdmin server, you should select "Yes, I want to be able to send mail as user@domain.com". If you use "No", it means email will leave from the Gmail servers which may cause your emails to be blocked, if the SPF records don't include gmail's sending IPs.** If unsure, just use "Yes" here, click "Next"**.

  2. The next page is called "Enter information about your other email address". The "Name" field is likely your name, eg: "Bob Smith", but the important part is the "Treat as an alias" checkbox. See this URLopen in new window to decide what you want to use. If unsure, leave it checked. Click "Next Step".

  3. On the "Send mail through your SMTP server" page, use the following settings:

Option nameValue
SMTP Servermail.domain.com
Usernameuser@domain.com
Passwordyoursecretpass
Port587
Secured connection using:TLS

Click "Add Account".

  1. You'll be asked to type in a code. Check your user@domain.com email account, if needed use https://www.domain.com/roundcube. Enter the code and press enter.

LMTP quota limit notifications

If you want to send email notices to user accounts at given percent thresholds, the exim.conf files use Dovecot's LMTP for deliveries rather than direct Maildir saves. With LTMP, dovecot must be responsible for quotas and notices.

The official documentation for that is: http://wiki2.dovecot.org/Quota/Configuration#Quota_warningsopen in new window

With a DirectAdmin CustomBuild 2.0 Dovecot 2.x setup, you can quickly enable 80%, 95% and 100% notices by typing:

cd /etc/dovecot/conf.d
wget -O 91-quota-warning.conf http://files1.directadmin.com/services/all/91-quota-warning.conf
wget -O /usr/local/bin/quota-warning.sh http://files1.directadmin.com/services/all/quota-warning.sh
chmod 755 /usr/local/bin/quota-warning.sh
1
2
3
4

and restart Dovecot:

service dovecot restart
1

How to see the last login for all email accounts, sorted by oldest first

If you want to find out who isn't logging in to determine if any account hasn't been used in a long time, you can create a script /root/last_login.sh and add the code:

#!/bin/sh
DAUSER=*
DOMAIN=*
EMLUSER=*

LOGIN_CACHE=/tmp/last_login.cache
echo -n '' > $LOGIN_CACHE
chmod 600 $LOGIN_CACHE

for c in `ls /home/$DAUSER/imap/$DOMAIN/$EMLUSER/Maildir/dovecot.index.log`; do
{
       LL=`stat $c | grep 'Change: ' | cut -d' ' -f2,3`
       U=`echo $c | cut -d/ -f3`
       D=`echo $c | cut -d/ -f5`
       E=`echo $c | cut -d/ -f6`
       echo "$LL=user=$U&domain=$D&email=$E" >> $LOGIN_CACHE
};
done;

cat $LOGIN_CACHE | sort -n
rm -f $LOGIN_CACHE

exit 0;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

Make it executable and run:

cd /root
chmod 755 last_login.sh
./last_login.sh
1
2
3

which will output all email accounts on the system, sorted by oldest login first.

If you only want the oldest 10 accounts, for example use "head":

./last_login.sh | head -n 10
1

For each line, the date will be on the far left, followed by the = character, followed by a url list, eg:

2019-10-07 01:31:08.684887527=user=fred&domain=fred.com&email=sales
1

The last login is determined only by checking the last change time of the dovecot.index.log file using "stat".

Note that an idle imap account won't keep updating this file, so it only refers to the actual time something was added to the log, like the original login or alteration of the account (I'm not 100% sure what it logs, so that's just a rough guess).

Point being, it's often several hours older than a potentially active but idle imap connection. So only use it to track down accounts that are days, weeks, or months old.

Don't use it to determine a login to the hour or second.

Last Updated: 6/23/2021, 9:36:08 PM