Email Client Configuration & Dovecot Quota/Monitoring Guide for DirectAdmin Users

This guide explains how to configure popular email clients (iPhone Mail, Thunderbird, Gmail POP/SMTP), enable Dovecot LMTP quota warnings, and check the last login time for all email accounts on a DirectAdmin server. It includes step by step instructions, recommended IMAP/SMTP settings, and useful administrative scripts.

Dovecot Quota

~5 min read • Updated Mar 1, 2026

1. Configuring Email on iPhone (Mail App)


To add your email account to the iPhone Mail app:

  1. Open SettingsAccounts & PasswordsAdd AccountOtherAdd Mail Account
  2. Enter:
  3. Tap Next

Incoming Mail Server (IMAP)


Host Name: mail.domain.com
User Name: [email protected]
Password: yourpassword

Outgoing Mail Server (SMTP)

Use the same settings as incoming:


Host Name: mail.domain.com
User Name: [email protected]
Password: yourpassword

Note: SMTP password is required.

Enable SSL for SMTP

Go to:


Settings → Accounts → [email protected] → Account → SMTP → Primary Server

Ensure:

  • Use SSL: ON
  • Authentication: Password
  • Server Port: 587

Enable SSL for IMAP

Go back to the account page → Advanced

  • Use SSL: ON
  • Authentication: Password
  • IMAP Path Prefix: /
  • Server Port: 993
---

2. Configuring Thunderbird Email Client


  1. Open ToolsAccount SettingsAccount ActionsAdd Mail Account
  2. Enter:
  3. Click Continue
  4. Click Manual config

Recommended Settings

TypeProtocolPortSSLAuth
IncomingIMAP993SSL/TLSNormal password
OutgoingSMTP587STARTTLSNormal password

Username (both incoming & outgoing): [email protected]

Use the hostname provided by your hosting provider (mail.domain.com or server.hostname.com).

If you see SSL warnings, you may accept them—usually the certificate hostname does not match the server name used.

---

3. Configuring Gmail (mail.google.com) to Fetch Emails via POP


  1. Login to https://mail.google.com
  2. Go to SettingsAccounts and Import
  3. Under Check mail from other accounts, click Add a mail account
  4. Enter [email protected]
  5. Select Import email from my other account (POP3)

POP Settings

OptionValue
Username[email protected]
Passwordyourpassword
POP Servermail.domain.com
Port995
SSLON

Click Add Account.

Sending mail as [email protected]

Choose Yes when asked:


Would you like to be able to send mail as [email protected]?

Recommended to avoid SPF issues.

SMTP Settings

OptionValue
SMTP Servermail.domain.com
Username[email protected]
Passwordyourpassword
Port587
SecurityTLS

Enter the verification code sent to your mailbox.

---

4. Enabling Dovecot LMTP Quota Warning Notifications


Dovecot can automatically notify users when their mailbox reaches 80%, 95%, or 100% of quota.

Step 1: Create quota warning config

File: /etc/dovecot/conf.d/91-quota-warning.conf

Dovecot 2.4.x:


quota "" {
  warning warn-100 {
    quota_storage_percentage = 100
    execute quota-warning {
      args = 100 %{user}
    }
  }
  warning warn-95 {
    quota_storage_percentage = 95
    execute quota-warning {
      args = 95 %{user}
    }
  }
  warning warn-80 {
    quota_storage_percentage = 80
    execute quota-warning {
      args = 80 %{user}
    }
  }
}

service quota-warning {
  executable = script /usr/local/bin/quota-warning.sh
  user = root
  unix_listener quota-warning {
    user = mail
    group = mail
    mode = 0660
  }
}

Dovecot 2.3.x:


plugin {
  quota_warning = storage=100%% quota-warning 100 %u %d
  quota_warning2 = storage=95%% quota-warning 95 %u %d
  quota_warning3 = storage=80%% quota-warning 80 %u %d
}
service quota-warning {
  executable = script /usr/local/bin/quota-warning.sh
  user = root
  unix_listener quota-warning {
    user = mail
    mode=0666
  }
}
---

Step 2: Create quota-warning.sh

File: /usr/local/bin/quota-warning.sh

Dovecot 2.4.x:


PERCENT=$1
USER=$2
FROM=$USER

cat << EOF | /usr/libexec/dovecot/dovecot-lda -d $USER -o "quota_enforce=no"
From: $FROM
Subject: Email Quota Usage: $PERCENT%

This is an automated notification letting you know that your account:
$USER

has used $PERCENT% of its available space.

EOF

Dovecot 2.3.x:


#!/bin/bash
PERCENT=$1
USER=$2
FROM=$USER

cat << EOF | /usr/libexec/dovecot/dovecot-lda -d $USER -o "plugin/quota=maildir:User quota:noenforcing"
From: $FROM
Subject: Email Quota Usage: $PERCENT%

This is an automated notification letting you know that your account:
$USER

has used $PERCENT% of its available space.

EOF
---

Step 3: Make script executable


chmod 0755 /usr/local/bin/quota-warning.sh

Step 4: Restart Dovecot


systemctl restart dovecot
---

5. Checking Last Login for All Email Accounts


Create script: /root/last_login.sh


#!/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;

Run it:


cd /root
chmod 755 last_login.sh
./last_login.sh

To show only the oldest 10 accounts:


./last_login.sh | head -n 10

Output example:


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

Note: This checks the timestamp of dovecot.index.log, which updates only when activity occurs—not during idle IMAP sessions.

Written & researched by Dr. Shahin Siami