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.