~5 min read • Updated Mar 1, 2026
1. Configuring Email on iPhone (Mail App)
To add your email account to the iPhone Mail app:
- Open Settings → Accounts & Passwords → Add Account → Other → Add Mail Account
- Enter:
- Name
- Email: [email protected]
- Password
- Description
- 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
- Open Tools → Account Settings → Account Actions → Add Mail Account
- Enter:
- Name
- Email: [email protected]
- Password
- Click Continue
- Click Manual config
Recommended Settings
| Type | Protocol | Port | SSL | Auth |
|---|---|---|---|---|
| Incoming | IMAP | 993 | SSL/TLS | Normal password |
| Outgoing | SMTP | 587 | STARTTLS | Normal 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
- Login to https://mail.google.com
- Go to Settings → Accounts and Import
- Under Check mail from other accounts, click Add a mail account
- Enter [email protected]
- Select Import email from my other account (POP3)
POP Settings
| Option | Value |
|---|---|
| Username | [email protected] |
| Password | yourpassword |
| POP Server | mail.domain.com |
| Port | 995 |
| SSL | ON |
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
| Option | Value |
|---|---|
| SMTP Server | mail.domain.com |
| Username | [email protected] |
| Password | yourpassword |
| Port | 587 |
| Security | TLS |
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