comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Attempt to send email using AWS results in Socket closed by peer
Date: Fri, 3 Sep 2021 23:13:38 +0200	[thread overview]
Message-ID: <sgu362$q1d$1@gioia.aioe.org> (raw)
In-Reply-To: lywnnxcs8w.fsf@pushface.org

On 2021-09-03 22:35, Simon Wright wrote:
> Juan Rayas <juan.m.rayas@gmail.com> writes:
> 
>>        Isp :=
>>          SMTP.Client.Initialize
>>            ("smtp.gmail.com", Port => 465,
>>             Credential             => Auth'Unchecked_Access);
> 
> I succeed sending mail via gmail.com using port 587.
> 
> No useful further details on encryption - this was for the membership
> d/b for a small club, and it's in Python/sqlite.

GNUTLS and OpenSSL have ways to tell to use the system certificates. 
E.g. if your Python application uses GNUTLS it would call

    gnutls_certificate_set_x509_system_trust

and that should be enough to make successful handshaking afterwards.

>      self.server = smtplib.SMTP(host=self.server_details['host'],
>                                 port=self.server_details['port'])
>      self.server.ehlo()
>      self.server.starttls()

Here it switches transport to GNUTLS or OpenSSL and these perform TLS 
handshaking. The following commands run over encrypted channel.

But with the port 587 you should actually begin with TLS straight away. 
StartTLS is for servers which allow both secure and insecure 
connections. This is usually the port 465. If you are OK with no 
encryption you greet with HELO and then proceed with login. If you want 
a secure connection you greet with EHLO and then send StartTLS.

>      self.server.ehlo()
>      self.server.login\
>          (user=server_details['user'],
>           password=keyring.get_password\
>             ('u3a-email', server_details['user']))

This is very low-level. AWS design is far better, IMO.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

      reply	other threads:[~2021-09-03 21:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 18:58 Attempt to send email using AWS results in Socket closed by peer Juan Rayas
2021-09-01 19:43 ` Dmitry A. Kazakov
2021-09-02 22:19   ` Randy Brukardt
2021-09-03  7:32     ` Dmitry A. Kazakov
2021-09-03  8:59       ` Doctor Who
2021-09-03 18:11         ` Juan Rayas
2021-09-03 18:31           ` Dmitry A. Kazakov
2021-09-03 19:33           ` Doctor Who
2021-09-03 20:29             ` Juan Rayas
2021-09-01 20:02 ` Dennis Lee Bieber
2021-09-02  3:29 ` Richard Iswara
2021-09-02  4:03 ` Doctor Who
2021-09-02 22:22   ` Randy Brukardt
2021-09-03 20:35 ` Simon Wright
2021-09-03 21:13   ` Dmitry A. Kazakov [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox