Daniel Ngu

Email Setup

msmtp

~/.msmtprc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
account First
host smtp.gmail.com
port 587
protocol smtp
auth on
from email-address
user email-address
password password
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

account Second
host smtp.gmail.com
port 587
protocol smtp
auth on
from email-address
user email-address
password password
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

account default : First

Offlineimap

~/.offlineimaprc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
[general]
ui = ttyui
accounts = First, Second

[Account First]
localrepository = First-Local
remoterepository = First-Remote

[Repository First-Local]
type = Maildir
localfolders = ~/Mail/First

[Repository First-Remote]
type = Gmail
remoteuser = email-address
remotepass = password
realdelete = no
maxconnections = 3
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

[Account Second]
localrepository = Second-Local
remoterepository = Second-Remote

[Repository Second-Local]
type = Maildir
localfolders = ~/Mail/Second

[Repository Second-Remote]
type = Gmail
remoteuser = email-address
remotepass = password
realdelete = no
maxconnections = 3
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

Mac:
For both ~/.msmtprc and ~/.offlineimaprc, change certificate path to /usr/local/opt/curl-ca-bundle/share/ca-bundle.crt instead.

Mutt

~/.muttrc
1
2
3
4
5
6
7
8
9
source ~/.mutt/accounts/First

folder-hook First/* source ~/.mutt/accounts/First
folder-hook Second/* source ~/.mutt/accounts/Second

macro index \e1  "<change-folder> =First/INBOX<enter>"
macro index \e2  "<change-folder> =Second/INBOX<enter>"

set editor='vim'
~/.mutt/accounts/First
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
set sendmail="msmtp-enqueue.sh -a First"
set envelope_from=yes
set from="name <email-address>"
set use_from=yes
set edit_headers=yes

set mbox_type=Maildir
set folder=~/Mail
set spoolfile="+First/INBOX"
set mbox="+First/[Gmail].All Mail"
set postponed="+First/[Gmail].Drafts"
unset record
mailboxes +First/INBOX

macro index D \
    "<save-message>+First/[Gmail].Bin<enter>" \
    "move message to the trash"

macro index S \
    "<save-message>+First/[Gmail].Spam<enter>" \
    "mark message as spam"

set sort=threads
set sort_aux=last-date-received

source ~/.mutt/colour/mutt-scheme.muttrc
~/.mutt/accounts/Second
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
set sendmail="msmtp-enqueue.sh -a Second"
set envelope_from=yes
set from="name <email-address>"
set use_from=yes
set edit_headers=yes

set mbox_type=Maildir
set folder=~/Mail
set spoolfile="+Second/INBOX"
set mbox="+Second/[Gmail].All Mail"
set postponed="+Second/[Gmail].Drafts"
unset record
mailboxes +Second/INBOX

macro index D \
    "<save-message>+Second/[Gmail].Bin<enter>" \
    "move message to the trash"

macro index S \
    "<save-message>+Second/[Gmail].Spam<enter>" \
    "mark message as spam"

set sort=threads
set sort_aux=last-date-received

source ~/.mutt/colour/mutt-scheme.muttrc
~/.mutt/colour/mutt-scheme.muttrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# header
color header cyan black "^from:"
color header cyan black "^to:"
color header cyan black "^cc:"
color header cyan black "^date:"
color header cyan black "^reply-to:"
color header cyan black "^subject:"
color header cyan black "^x-mailer:"

# Default color definitions
color signature brightmagenta black
color indicator black cyan
color attachment yellow black
color error red black
color message white black
color search brightwhite magenta
color status brightgreen blue
color tree red black
color normal white black
color tilde green black
color bold brightyellow black
color markers red black

msmtpqueue

Download and extract msmtpqueue to ~/bin