June 18, 2024

Set up msmtp to queue sent emails offline

To set up msmtpq I followed /usr/share/doc/msmtp/examples/msmtpq/README.msmtpq and the short section on msmtpq of a blog post titled A simple mail transfer agent.

Below I describe the steps I took.

Copy the following files:

sudo cp /usr/share/doc/msmtp/examples/msmtpq/msmtpq /usr/local/bin/
sudo cp /usr/share/doc/msmtp/examples/msmtpq/msmtp-queue /usr/local/bin/

Update the following line in .muttrc:

set sendmail ="/usr/local/bin/msmtpq" 

Add the following line in .muttrc:

set sendmail_wait = -1

Create:

$ mkdir .msmtp/mailqueue/msmtpq 
$ touch .msmtp/mailqueue/msmtpq
$ echo > .msmtp/mailqueue/msmtpq << EOF
Q=~/.msmtp/mailqueue
LOG=~/.msmtp/log/msmtp.queue.log

You might need to update file permissions, check A simple mail transfer.

In /usr/local/bin/msmtpq update:

Q=~/.msmtp.queue

to:

Q=~/.msmtp/mailqueue

To test msmtpq, disconnect from the internet and send an email. Mutt should print Mail sent on the prompt, at the bottom.

To check that the email was queued, run:

$ msmtp-queue

The terminal should print something like:

  mail  num=[ 1 ]  id=[ 2024-06-13-18.11.00 ]
From: JD <j@d.com>
To: j@d.com
Subject: test msmtpq

Alias

In ~/.bash_aliases I added:

alias queue='msmtp-queue'

I can pass the option msmtp-queue offers to the alias fine e.g. queue -h.

✍✍✍✍✍✍✍✍✍✍✍✍✍✍

I do self-funded research and I'm writing a book.

> What's the book about?

About technologies and agency.

Meaning, technologies can foster agency. No doubt. But I am also asking:

Can usage of technologies give us a sense of empowerment while in fact undermining our abilities?

I posted a summary of the prologue on the homepage: https://yctct.com/

✍✍✍✍✍✍✍✍✍✍✍✍✍✍


personal computing command-line interface (cli) gnu linux trisquel shell literacy office applications wiki msmtp mutt

No affiliate links, no analytics, no tracking, no cookies. This work © 2016-2024 by yctct.com is licensed under CC BY-ND 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88