Sending mail with Emacs and msmtp

13 replies [Last post]
calher

I am a member!

Offline
Joined: 06/19/2015

I'm having difficulties sending mail with msmtp and Emacs.

I installed several packages.

sudo apt install notmuch isync afew msmtp maildir-utils

Configs attached. "config" is my msmtp config.

When I do C-x m in Emacs, I get a buffer that looks like this:

To:
Subject:
From: Caleb Herbert

--text follows this line--

It should show my actual email address.

--
Thanks,
Caleb

https://bluehome.net/csh/

Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

Configs attached.

I see no attachment.

calher

I am a member!

Offline
Joined: 06/19/2015

Sorry. I guess the mailing list interface did not take my email attachments.

I do not know the correct path to the SSL certs.

Currently, C-x m looks like this.

To:
Subject:
From: Caleb Herbert [less-than] caleb [at] bender.i-did-not-set--mail-host-address--so-tickle-me [greater-than]
--text follows this line--

Configs attached.

AttachmentSize
dot-emacs.txt 469 bytes
dot-mbsyncrc.txt 709 bytes
dot-msmtprc.txt 341 bytes
Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

Does msmtp successfully send mail from the terminal?

calher

I am a member!

Offline
Joined: 06/19/2015

Sorry, how do I do that?

iShareFreedom
Offline
Joined: 12/20/2021

Maybe using Emacs from a terminal?

calher

I am a member!

Offline
Joined: 06/19/2015

It doesn't detect the password provided to msmtp.

send-with-emacs.png
Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

According to https://manpages.ubuntu.com/manpages/focal/man1/msmtp.1.html (I do not have msmtp installed):
Sendmail mode (default):
msmtp [option...] [--] recipient...
(...)
In the default sendmail mode, msmtp reads a mail from standard input and sends it to an
SMTP server for delivery.

So, I would try (substituting "recipient" with an email address):
$ echo banana | msmtp recipient

calher

I am a member!

Offline
Joined: 06/19/2015

Account default not found.

account-not-found.png
calher

I am a member!

Offline
Joined: 06/19/2015

Made some changes to my mysmtprc. It sends from the command line now. Screenshot attached.

C-x m in Emacs still has the wrong From line. Screenshot attached.

sent.png wrong-from-line.png
AttachmentSize
dot-msmtprc.txt 374 bytes
Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

Given what is written there, you obviously need to set mail-host-address (does it tickle?). On https://pagefault.se/post/email-in-emacs/#sending-emails eric sets some other variables too.

calher

I am a member!

Offline
Joined: 06/19/2015

Good news!

The mail sends from Emacs!

But the From says caleb at bluehome dot net rather than csh at bluehome dot net.

wrong-username.png
AttachmentSize
dot-emacs.txt 753 bytes
Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

Set "user-mail-address" (with 2 Ds) instead of "user-mail-adress" (with 1 D). That should do it, according to https://www.gnu.org/software/emacs/manual/html_node/emacs/Mail-Headers.html

calher

I am a member!

Offline
Joined: 06/19/2015

Oh, I didn't see that. It all works now! Thanks!