1

So I first time reported a bug from Emacs and but sending emails was not working. I send the email from my email client but I would like to setup Emacs to allow sending emails. And I can't find any information about how to do that.

I only found this old post to emacs mailing list:

help: cannot send mail by emacs+gnus

When sending email I get this error:

454 4.7.1 <[email protected]>: Relay access denied

This is my code:

(setq message-send-mail-function 'smtpmail-send-it)
(setq smtpmail-smtp-server "jcubic.<server>")
(setq smtpmail-smtp-service 465)
(setq user-mail-address "jcubic@<server>")
(setq smtpmail-auth-credentials
      '(("jcubic.<server>" 465 "jcubic@<server>" "<password>")))
(setq smtpmail-stream-type 'ssl)
(setq smtpmail-debug-info t)

This is the session I've got when sending test email:

220 u1.atthost.pl ESMTP Postfix
250-u1.atthost.pl
250-PIPELINING
250-SIZE 1024000000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
MAIL FROM:<[email protected]> SIZE=230
250 2.1.0 Ok
RCPT TO:<[email protected]>
454 4.7.1 <[email protected]>: Relay access denied
QUIT
221 2.0.0 Bye

Process smtpmail<1> deleted

The problem is that there are no AUTH LOGIN command that should be first in SMTP session.

This is proper email I've send using openssl:

$ openssl s_client -connect jcubic.<server>:465 -quiet
depth=2 C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
verify return:1
depth=1 C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
verify return:1
depth=0 CN = atthost.pl
verify return:1
220 u1.atthost.pl ESMTP Postfix
EHLO jcubic.pl
250-u1.atthost.pl
250-PIPELINING
250-SIZE 1024000000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH LOGIN
334 VXNlcm5hbWU6
amN1YmljQGpjdWJpYy5wbA==
334 UGFzc3dvcmQ6
<base 64 encoded password>
235 2.7.0 Authentication successful
MAIL FROM: <[email protected]>
250 2.1.0 Ok
RCPT TO: <[email protected]>
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: Test Email
to: [email protected]
from: [email protected]

Hello this is message
.
250 2.0.0 Ok: queued as 300BB122BC2

As you can see there is AUTH LOGIN command. Why I don't get that from Emacs?

Also all information online shows this config:

(setq smtpmail-auth-credentials
      '(("jcubic.<server>" 465 "jcubic@<server>" "<password>")))

but there are no documentation for that variable.

I was reading that this variable is deprecated Authentication and you should use ~/.authinfo file but it doesn't work. I saved my data and it's not read. It also did not ask me for username and password like it say in previous document.

1 Answer 1

0

I've asked on emacs help mailing list and they replied with this information:

try setting:

machine "jcubic.<server>" login "jcubic@<server>" password "<password>" force yes

in your .authinfo(.gpg) instead of using smtpmail-auth-credentials (which has been removed in 2011). The "force yes" ensures it will authenticate although the server doesn't mandate it.

setting "force yes" in .authinfo solved the issue and the email was sent:

This the output I've got:

220 u1.atthost.pl ESMTP Postfix
250-u1.atthost.pl
250-PIPELINING
250-SIZE 1024000000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH PLAIN <omitted>
235 2.7.0 Authentication successful
MAIL FROM:<[email protected]> SIZE=230
250 2.1.0 Ok
RCPT TO:<[email protected]>
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
From: "Jakub T. Jankiewicz" <[email protected]>
To: [email protected]
Subject: Hello
Date: Fri, 17 Nov 2023 15:02:37 +0100
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain

This is test email
.
250 2.0.0 Ok: queued as 8428B123715
QUIT
221 2.0.0 Bye

Process smtpmail deleted

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.