Getmail & Mutt setup with I2P

HowTos, FAQs, Tips & Tricks, & Guides
Post Reply
andreas
Posts: 3
Joined: 11 Jul 2020 09:22

Getmail & Mutt setup with I2P

Post by andreas »

Guide to setting up I2P mail using Getmail for fetching emails via POP and Mutt, assuming you already have I2P installed on your system and it works.

1. Install Getmail[1] and Mutt[2] (I used Neomutt[3])

2. Configure getmail to fetch your emails into a folder that Mutt will later read (example getmailrc below, usually placed in your /home/user/.getmail/getmailrc - if doesn't exist create it with a text editor)

3. Configure Mutt or Neomutt to display emails in that folder (example configuraiton file below, usually placed in /home/user/.mutt/muttrc)

Once it works and you can receive and send emails you may notice two things:

(a) When you compose emails to external/non-I2P email addresses, your "From:" address will show as "yourusername@mail.i2p". That's fine, the recipient will see "yourusername@i2pmail.org" when it arrives and so will be able to reply. (NOTE emails may take a long time to arrive, so don't assume like I did that it doesn't work.)

(b) When you send an email back from your external/non-I2P email address, you will send the email to "yourusername@i2pmail.org" as the mail.i2p address will bounce. However, when you fetch this email via POP using the configuration below, the header will show that the "To:" field is your mail.i2p address - not the i2pmail.org address which you sent the email to.

But it seems to work, so I'd just ignore the "From:" information and let I2P deal with external/internal recipients. If someone on the development team sees this and can explain why the headers are altered it'd be great.




[1]: https://wiki.archlinux.org/index.php/Getmail
[2]: https://www.thegeekdiary.com/how-to-ins ... ntos-rhel/
[3]: https://neomutt.org/


Working Getmail config on Ubuntu 20.04 LTS:

Code: Select all


# Get mail from i2p

[retriever]
type = SimplePOP3Retriever
server = 127.0.0.1
username = andreas
port = 7660
password = 'password'


# Decide where to put the mail

[destination]
type = Maildir
path = ~/.mutt/Mail/Inbox/
# In case it's a missing "From "-line, solutions to fix new mail vary by program(s) used to get new mail
# From https://gitlab.com/muttmua/mutt/-/wikis/MuttFaq/Folder
unixfrom = true

[options]
verbose = 2
message_log_verbose = true
message_log = ~/.getmail/getmail.log
# Add some headers to all messages, specifically:
#   1. Delivered-To: header field (disabled as it does not work here)
#   2. Received: header field (enabled)
delivered_to = true
received = true
# Delete from remote server after download:
delete = true

# Most people will like to add the following section to their getmailrc to prevent all the mail on the server being downloaded every time getmail is ran.
read_all = false

Working muttrc config on Ubuntu 20.04 LTS:

Code: Select all

## Neomuttrc

####### Identity

# From https://feeding.cloud.geek.nz/posts/handling-multiple-identitiesaccounts-in/
# and this one pre-fills the From address when replying to emails based on the email account that received the original mail:
set reverse_name
set realname = "Andreas"
set use_envelope_from = yes

# If you have another address:
alternates "andreas@i2pmail.org|andreas@mail.i2p"

set from = "andreas@mail.i2p"

# allow me to change the From address within the editor, in case I forgot to set the right one before pressing 'm':
set use_from = yes


# Enable full edit of headers
set edit_headers=yes


###### SMTP settings
set smtp_pass = 'password'
set smtp_url = "smtp://andreas@127.0.0.1:7659"
set ssl_force_tls = no


# Some people use mbsync or getmail to retrieve their mail locally.
#
set mbox_type=Maildir
set folder = ~/.mutt/Mail/           # This has the shortcut '+' or '='

set spoolfile = +Inbox      # This has the shortcut '!'
set record = +Sent
set trash = +Trash
set postponed = +Drafts

mailboxes +Inbox +Sent +Trash +Drafts

# Prefer plain text to html.
# However, for brain dead clients that bundle attachments inside a
# multipart/alternative, prefer that alternative.
alternative_order multipart/mixed multipart/related text/plain

# Consult mime.types for determining types of these attachments
mime_lookup application/octet-stream

# This requires a ~/.mailcap entry with the copiousoutput flag, such as:
# text/html; lynx -dump -width ${COLUMNS:-80} %s; nametemplate=%s.html; copiousoutput
auto_view text/html

###############
# Index settings
#
set quit = ask-yes
set sort = threads

## Set Folders
set header_cache= "~/.mutt/cache/headers"
set message_cachedir = "~/.mutt/cache/bodies"
set certificate_file = "~/.mutt/certificates"


#### ETC 

set mail_check = 30
set move = no

### Turn on neomutt sidebar

set sidebar_visible
set sidebar_format = "%B%?F? [%F]?%* %?N?%N/?%S"
set mail_check_stats



###############
# Message composition settings
#
# set editor = "emacsclient -a emacs -t"
set editor = "micro"

set mime_type_query_command = "xdg-mime query filetype"

# msmtp is a solid SMTP client.
# neomutt also has built-in SMTP, or you can use an MTA like exim4 or postfix.
set sendmail = "/usr/bin/msmtp"

# lbdb is a versatile contact query tool.
# Invoke via ctrl-t in an address prompt
set query_command = "/usr/bin/lbdbq"

Last edited by andreas on 11 Aug 2020 09:12, edited 1 time in total.
andreas
Posts: 3
Joined: 11 Jul 2020 09:22

Re: Getmail & Mutt setup with I2P

Post by andreas »

err, I apologise - I think I posted this in the wrong forum. And I can't figure out how to move it :|
andreas
Posts: 3
Joined: 11 Jul 2020 09:22

Re: Getmail & Mutt setup with I2P

Post by andreas »

andreas wrote: 11 Aug 2020 00:18 err, I apologise - I think I posted this in the wrong forum. And I can't figure out how to move it :|
Actually I think it can serve as a guide, would've been helpful to me for sure.
User avatar
eyedeekay
Posts: 75
Joined: 21 Jul 2018 06:53

Re: Getmail & Mutt setup with I2P

Post by eyedeekay »

Do you have any interest in adapting your procedure for Thunderbird auto-configuration? https://github.com/thundernest/autoconfig
Post Reply