Sending mail with Emacs and msmtp

13 risposte [Ultimo contenuto]
calher

I am a member!

Offline
Iscritto: 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
Iscritto: 07/24/2010

Configs attached.

I see no attachment.

calher

I am a member!

Offline
Iscritto: 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.

AllegatoDimensione
dot-emacs.txt 469 byte
dot-mbsyncrc.txt 709 byte
dot-msmtprc.txt 341 byte
Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

Does msmtp successfully send mail from the terminal?

calher

I am a member!

Offline
Iscritto: 06/19/2015

Sorry, how do I do that?

iShareFreedom
Offline
Iscritto: 12/20/2021

Maybe using Emacs from a terminal?

calher

I am a member!

Offline
Iscritto: 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
Iscritto: 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
Iscritto: 06/19/2015

Account default not found.

account-not-found.png
calher

I am a member!

Offline
Iscritto: 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
AllegatoDimensione
dot-msmtprc.txt 374 byte
Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 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
Iscritto: 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
AllegatoDimensione
dot-emacs.txt 753 byte
Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 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
Iscritto: 06/19/2015

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