Browse Source

Add email configuration

Ian Adam Naval 5 years ago
parent
commit
77076a536e

+ 4
- 0
bin/README View File

@@ -0,0 +1,4 @@
1
+Just a collection of useful programs. I usually just stick all of these in
2
+/usr/local/bin because I am too lazy to have a ~/.bin directory or something
3
+similar.
4
+

+ 56
- 0
bin/exchangebook View File

@@ -0,0 +1,56 @@
1
+#!/bin/sh
2
+# Crappy shell script to parse WPI's address book. Designed for mutt.
3
+# Uses LDAP over TLS to query information.
4
+#
5
+# To use in mutt, add this to your .muttrc
6
+#   set query_command="/path/to/this/script '%s'"
7
+#
8
+# To combine with goobook, you can just do this:
9
+#   set query_command="goobook query '%s'; /path/to/this/script '%s'"
10
+
11
+# pass all arguments to LDAP search
12
+query=$@
13
+
14
+# authentication
15
+username=ianaval
16
+password=$(pass WPI_UNIX)
17
+
18
+# sketchy, but we don't require verification of TLS certs
19
+# at least we're not transmitting plaintext passwords
20
+export LDAPTLS_REQCERT=never
21
+
22
+# Use WPI's PAM binddn to get the user's binddn
23
+binddn=$(ldapsearch -ZZ -LLL -x -b dc=wpi,dc=edu -H ldap://ldapv2back.wpi.edu/ -D cn=pam,ou=access,dc=wpi,dc=edu -w $(pass ldapv2back) "(|(uid=$username))" dn | awk '{print $2}' 2>/dev/null)
24
+
25
+# Makes names look like "Naval, Ian A."
26
+parse_name() {
27
+	case $# in
28
+		2) echo "$2, $1" ;;
29
+		3) echo "$3, $1 ${2:0:1}." ;;
30
+		*) echo "$@" ;;
31
+	esac
32
+}
33
+
34
+# loop line by line
35
+OIFS="${IFS}"
36
+NIFS=$'\n'
37
+IFS="${NIFS}"
38
+for line in $(ldapsearch -ZZ -LLL -x -H ldap://ldapv2back.wpi.edu/ -D $binddn -w $password -b "dc=wpi,dc=edu" "(|(uid=$query)(cn=*$query*)(displayName=*$query*))" displayName mail 2>/dev/null); do
39
+	IFS="${OIFS}"
40
+	# parse displayName (might not be in the right order)
41
+	if [[ $line =~ displayName* ]]; then
42
+		displayName=$(parse_name $(echo "$line" | sed -e 's/displayName: //'))
43
+	fi
44
+	# parse email
45
+	if [[ $line =~ mail* ]]; then
46
+		mail=$(echo "$line" | sed -e 's/mail: //')
47
+	fi
48
+	# print address book record with the group being 'none'
49
+	if [[ -n $displayName ]] && [[ -n $mail ]]; then
50
+		printf "$mail\t$displayName\tnone\n"
51
+		displayName=""
52
+		mail=""
53
+	fi
54
+	IFS="${NIFS}"
55
+done
56
+IFS="${OIFS}"

+ 17
- 0
mutt/gookbookrc.dotfile View File

@@ -0,0 +1,17 @@
1
+# "#" or ";" at the start of a line makes it a comment.
2
+[DEFAULT]
3
+# If not given here, email and password is taken from .netrc using
4
+# machine google.com
5
+email: ianonavy@gmail.com
6
+passwordeval: pass mbsync
7
+# The following are optional, defaults are shown
8
+cache_filename: ~/.goobook_cache
9
+cache_expiry_hours: 24
10
+;filter_groupless_contacts: yes
11
+# New contacts will be added to this group in addition to "My Contacts"
12
+# Note that the group has to already exist on google or an error will occur.
13
+# One use for this is to add new contacts to an "Unsorted" group, which can
14
+# be sorted easier than all of "My Contacts".
15
+#    searching for groupless users is a bit painful.
16
+default_group:Unsorted
17
+

+ 85
- 0
mutt/mbsyncrc.dotfile View File

@@ -0,0 +1,85 @@
1
+# ------------------------------------------------------------------------------
2
+# gmail - ianonavy@gmail.com
3
+# ------------------------------------------------------------------------------
4
+IMAPAccount gmail
5
+Host imap.gmail.com
6
+User ianonavy@gmail.com
7
+PassCmd "pass mbsync"
8
+SSLType IMAPS
9
+SSLVersions TLSv1.2
10
+CertificateFile /etc/ssl/certs/ca-certificates.crt
11
+
12
+IMAPStore gmail-remote
13
+Account gmail
14
+
15
+MaildirStore gmail-local
16
+# The trailing "/" is important
17
+Path ~/.mail/gmail/
18
+Inbox ~/.mail/gmail/Inbox
19
+
20
+Channel sync-gmail-default
21
+Master :gmail-remote:
22
+Slave :gmail-local:
23
+# Select some mailboxes to sync
24
+Patterns "INBOX" "Banking"
25
+Create Both
26
+SyncState *
27
+
28
+Channel sync-gmail-archived
29
+Master :gmail-remote:"[Gmail]/All Mail"
30
+Slave :gmail-local:Archived
31
+Create Slave
32
+SyncState *
33
+
34
+Channel sync-gmail-sent
35
+Master :gmail-remote:"[Gmail]/Sent Mail"
36
+Slave :gmail-local:Sent
37
+Create Slave
38
+SyncState *
39
+
40
+Channel sync-gmail-spam
41
+Master :gmail-remote:"[Gmail]/Spam"
42
+Slave :gmail-local:Spam
43
+Create Slave
44
+SyncState *
45
+
46
+Channel sync-gmail-trash
47
+Master :gmail-remote:"[Gmail]/Trash"
48
+Slave :gmail-local:Trash
49
+Create Slave
50
+SyncState *
51
+
52
+# Get all the channels together into a group.
53
+Group gmail
54
+Channel sync-gmail-default
55
+Channel sync-gmail-archived
56
+Channel sync-gmail-sent
57
+Channel sync-gmail-spam
58
+Channel sync-gmail-trash
59
+
60
+# ------------------------------------------------------------------------------
61
+# school - ianaval@wpi.edu
62
+# ------------------------------------------------------------------------------
63
+IMAPAccount school
64
+Host exchange.wpi.edu
65
+User ianaval@wpi.edu
66
+PassCmd "pass WPI_Email"
67
+SSLType IMAPS
68
+SSLVersions TLSv1 TLSv1.1 TLSv1.2
69
+CertificateFile /etc/ssl/certs/ca-certificates.crt
70
+
71
+IMAPStore school-remote
72
+Account school
73
+
74
+MaildirStore school-local
75
+# The trailing "/" is important
76
+Path ~/.mail/school/
77
+Inbox ~/.mail/school/Inbox
78
+
79
+Channel school
80
+Master :school-remote:
81
+Slave :school-local:
82
+# Select some mailboxes to sync
83
+Patterns *
84
+Create Both
85
+SyncState *

+ 1
- 0
mutt/mutt.dotfile/.gitignore View File

@@ -0,0 +1 @@
1
+shadow.gpg

+ 0
- 0
mutt/mutt.dotfile/alias View File


+ 0
- 0
mutt/mutt.dotfile/certificates View File


+ 14
- 0
mutt/mutt.dotfile/crypto View File

@@ -0,0 +1,14 @@
1
+# -*-muttrc-*-
2
+set pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f"
3
+set pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f"
4
+set pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f"
5
+set pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f"
6
+set pgp_clearsign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f"
7
+set pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0x8C8474B3 -- -r %r -- %f"
8
+set pgp_encrypt_sign_command="pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0x8C8474B3 -- -r %r -- %f"
9
+set pgp_import_command="gpg --no-verbose --import -v %f"
10
+set pgp_export_command="gpg --no-verbose --export --armor %r"
11
+set pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r"
12
+set pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r" 
13
+set pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r" 
14
+

+ 21
- 0
mutt/mutt.dotfile/gmail View File

@@ -0,0 +1,21 @@
1
+# -*-muttrc-*-
2
+set imap_user=ianonavy@gmail.com
3
+set imap_pass=$my_pw_gmail
4
+set folder=/home/ian/.mail/gmail/
5
+#set mbox=+Archived
6
+set spoolfile=+Inbox
7
+unmailboxes *
8
+mailboxes \
9
+	+Inbox \
10
+	+Archived \
11
+	+Banking \
12
+	+Sent \
13
+	+Trash
14
+
15
+set realname = 'Ian Adam Naval'
16
+set from = ianonavy@gmail.com
17
+set use_from = yes
18
+
19
+set smtp_url=smtps://ianonavy@gmail.com:$my_pw_gmail@smtp.gmail.com
20
+set ssl_force_tls = yes
21
+

+ 17
- 0
mutt/mutt.dotfile/ianonavy.com View File

@@ -0,0 +1,17 @@
1
+# -*-muttrc-*-
2
+set imap_user=ian@ianonavy.com
3
+set imap_pass="$my_pw_ianonavy"
4
+set folder=imaps://ian@ianonavy.com@imap.gmail.com/
5
+set mbox="imaps://imap.gmail.com/[Gmail]/All Mail"
6
+set spoolfile=+INBOX
7
+mailboxes =INBOX
8
+mailboxes imaps://ian@ianonavy.com@imap.gmail.com/INBOX
9
+
10
+set realname = 'Ian Adam Naval'
11
+set from = ian@ianonavy.com
12
+set use_from = yes
13
+
14
+set smtp_url=smtps://ian@ianonavy.com:$my_pw_ianonavy@smtp.gmail.com
15
+set ssl_force_tls = yes
16
+
17
+account-hook $folder "set imap_user=ian@ianonavy.com imap_pass=$my_pw_ianonavy"

+ 3
- 0
mutt/mutt.dotfile/mailcap View File

@@ -0,0 +1,3 @@
1
+text/html;    elinks %s; nametemplate=%s.html
2
+text/html;     elinks -dump -default-mime-type text/html %s; needsterminal; copiousoutput;
3
+image/*; feh %s;

+ 24
- 0
mutt/mutt.dotfile/school View File

@@ -0,0 +1,24 @@
1
+#-*-muttrc-*-
2
+set imap_user=ianaval@wpi.edu
3
+set imap_pass=$my_pw_school
4
+set folder=/home/ian/.mail/school/
5
+set postponed=+Drafts
6
+set record="+Sent Items"
7
+set mbox=+Archived
8
+set spoolfile=+Inbox
9
+unmailboxes *
10
+mailboxes \
11
+	+Inbox \
12
+	+Archived \
13
+	+Drafts \
14
+	+"Sent Items" \
15
+	+"Junk E-mail" \
16
+	+Trash
17
+
18
+set realname = 'Naval, Ian A'
19
+set from = ianaval@wpi.edu
20
+set use_from = yes
21
+
22
+set smtp_url=smtps://ianaval:$my_pw_school@submission.wpi.edu
23
+set ssl_force_tls = yes
24
+

+ 24
- 0
mutt/mutt.dotfile/work View File

@@ -0,0 +1,24 @@
1
+# -*-muttrc-*-
2
+set imap_user=ian@adhamonics.com
3
+set imap_pass=$my_pw_work
4
+set folder=imaps://ian@adharmonics.com@imap.gmail.com/
5
+set mbox="imaps://imap.gmail.com/[Gmail]/All Mail"
6
+set spoolfile=+INBOX
7
+
8
+unmailboxes *
9
+mailboxes \
10
+	+INBOX \
11
+	+"[Gmail]/All Mail" \
12
+	+"[Gmail]/Drafts" \
13
+	+"[Gmail]/Sent Mail" \
14
+	+"[Gmail]/Spam" \
15
+	+"[Gmail]/Trash"
16
+
17
+set realname = 'Ian Adam Naval'
18
+set from = ian@adharmonics.com
19
+set use_from = yes
20
+
21
+set smtp_url=smtps://ian@adharmonics.com:$my_pw_work@smtp.gmail.com
22
+set ssl_force_tls = yes
23
+
24
+account-hook $folder "set imap_user=ian@adharmonics.com imap_pass=$my_pw_work"

+ 116
- 0
mutt/muttrc.dotfile View File

@@ -0,0 +1,116 @@
1
+# -*-muttrc-*-
2
+source "gpg2 -dq $HOME/.mutt/shadow.gpg |""
3
+source ~/.mutt/crypto
4
+
5
+# PGP ------------------------------------------------
6
+set pgp_use_gpg_agent = yes
7
+set pgp_autosign = yes
8
+set pgp_auto_decode = yes
9
+
10
+# Index Key Bindings ---------------------------------
11
+bind index gg       first-entry
12
+bind index G        last-entry
13
+bind index R        group-reply
14
+bind index <tab>    sync-mailbox
15
+bind index <space>  collapse-thread
16
+
17
+# Ctrl-R to mark all as read
18
+macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read"
19
+# Ctrl-A to archive all
20
+macro index \Ca "T.*<enter><tag-prefix><save-message>=Archived<enter>" "archive all message"
21
+
22
+# Sync email
23
+macro index ss "<shell-escape>mbsync -a<enter>"
24
+
25
+# Saner copy/move dialogs
26
+macro index C "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox"
27
+macro index M "<save-message>?<toggle-mailboxes>" "move a message to a mailbox"
28
+macro index,pager A "<save-message>=Archived<enter>" "Archive Message"
29
+
30
+# Goobook
31
+macro index,pager a "<pipe-message>goobook add<return>" "add sender to google contacts"
32
+bind editor <Tab> complete-query
33
+
34
+# Sidebar Navigation ---------------------------------
35
+bind index,pager <down>   sidebar-next
36
+bind index,pager <up>     sidebar-prev
37
+bind index,pager <right>  sidebar-open
38
+macro index b '<enter-command>toggle sidebar_visible<enter><refresh>'
39
+macro pager b '<enter-command>toggle sidebar_visible<enter><redraw-screen>'
40
+bind index B bounce-message
41
+
42
+# Basic Options --------------------------------------
43
+set sort = threads       # prettier inbox
44
+set wait_key = no        # shut up, mutt
45
+set mbox_type = Maildir  # mailbox type
46
+set timeout = 3          # idle time before scanning
47
+set mail_check = 0       # minimum time between scans
48
+unset move               # gmail does that
49
+set delete               # don't ask, just do
50
+unset confirmappend      # don't ask, just do!
51
+set quit                 # don't ask, just do!!
52
+unset mark_old           # read/new is good enough for me
53
+set beep_new             # bell on new mails
54
+set pipe_decode          # strip headers and eval mimes when piping
55
+set thorough_search      # strip headers and eval mimes before searching
56
+unset record             # gmail saves a copy of the sent message
57
+set query_command = "goobook query '%s'; exchangebook '%s'"
58
+alternative_order text/html text/enriched text/plain
59
+auto_view text/html
60
+
61
+# Paths ----------------------------------------------
62
+set folder           = ~/.mail               # mailbox location
63
+set alias_file       = ~/.mutt/alias         # where to store aliases
64
+set header_cache     = ~/.mutt/cache/headers # where to store headers
65
+set message_cachedir = ~/.mutt/cache/bodies  # where to store bodies
66
+set certificate_file = ~/.mutt/certificates  # where to store certs
67
+set mailcap_path     = ~/.mutt/mailcap       # entries for filetypes
68
+set tmpdir           = ~/.mutt/temp          # where to keep temp files
69
+
70
+# Sidebar Patch --------------------------------------
71
+set sidebar_delim   = ' │'
72
+set sidebar_visible = yes
73
+set sidebar_width   = 32
74
+color sidebar_new color221 color233
75
+
76
+# Status Bar -----------------------------------------
77
+set status_chars  = " *%A"
78
+set status_format = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───"
79
+
80
+# Accounts -------------------------------------------
81
+source "~/.mutt/ianonavy.com"
82
+folder-hook $folder 'source ~/.mutt/ianonavy.com'
83
+macro index,pager oi '<sync-mailbox><enter-command>source ~/.mutt/ianonavy.com<enter><change-folder>!<enter>'
84
+
85
+source "~/.mutt/work"
86
+folder-hook $folder 'source ~/.mutt/work'
87
+macro index,pager ow '<sync-mailbox><enter-command>source ~/.mutt/work<enter><change-folder>!<enter>'
88
+
89
+source "~/.mutt/gmail"
90
+folder-hook $folder 'source ~/.mutt/gmail'
91
+macro index,pager og '<sync-mailbox><enter-command>source ~/.mutt/gmail<enter><change-folder>!<enter>'
92
+
93
+source "~/.mutt/school"
94
+folder-hook $folder 'source ~/.mutt/school'
95
+macro index,pager os '<sync-mailbox><enter-command>source ~/.mutt/school<enter><change-folder>!<enter>'
96
+
97
+# Palette for use with the Linux console.  Black background.
98
+color hdrdefault blue black
99
+color quoted blue black
100
+color signature blue black
101
+color attachment red black
102
+color message brightred black
103
+color error brightred black
104
+color indicator black green
105
+color status brightgreen black
106
+color tree white black
107
+color normal white black
108
+color markers red black
109
+color search white black
110
+color tilde brightmagenta black
111
+color index blue black ~F
112
+color index red black "~N|~O"
113
+
114
+color body brightwhite black '\*+[^*]+\*+'
115
+color body brightwhite black '_+[^_]+_+'
116
+

Loading…
Cancel
Save