help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with TLS when sending emails


From: Leo Butler
Subject: Re: Problem with TLS when sending emails
Date: Wed, 11 May 2022 15:34:12 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

On Wed, May 11 2022, Alessandro Bertulli <alessandro.bertulli96@gmail.com> 
wrote:

> Hi all.
> I was trying to set up my Gmail configuration to send emails from
> Emacs. However, I encounter a problem with TLS.
>
> 1) I set up a file ~/.authinfo.gpg, where I put
>
> machine imap.gmail.com login alessandro.bertulli96@gmail.com password
> -pswd- port 993
> machine smtp.gmail.com login alessandro.bertulli96@gmail.com password
> -pswd- port 587
>
> Note that "-pswd-" is actually the 16 char long app password generated
> by Gmail, required to use external clients.
>
> 2) My init file contains
>
> (setq user-full-name "Alessandro Bertulli"
>       user-mail-address "alessandro.bertulli96@gmail.com")
> (setq smtpmail-smtp-server "smtp.gmail.com"
>       smtpmail-smtp-service 587
>       smtpmail-stream-type  'ssl
>       smtpmail-debug-info t)
> ;; Configure the function to use for sending mail
> (setq message-send-mail-function 'smtpmail-send-it)

I have exactly the same configuration for gmail, except
smtpmail-stream-type is nil (which according to the documentation, means
the connection is upgraded with starttls if possible). That works fine.
I have not tried Robert Pluim's suggestion to use port 465.

Note that you can use `gnus-posting-styles' to insert the correct
smtpmail information into your email, when mailing from Gnus (I have
never used C-x m outside of Gnus).

E.g. (assuming your nnimap server is named GoogleMail)

#+begin_src emacs-lisp
(setq gnus-posting-styles '(
                             ("GoogleMail:.+"
                             (address "SomeOne@gmail.com")
                             (X-Message-SMTP-Method "smtp smtp.gmail.com 587 
SomeOne@gmail.com"))))
#+end_src

This is handy if you are managing multiple email accounts within Gnus.

Leo


reply via email to

[Prev in Thread] Current Thread [Next in Thread]