comp.lang.ada
 help / color / mirror / Atom feed
From: Richard Iswara <haujekchifan@gmail.com>
Subject: Re: Attempt to send email using AWS results in Socket closed by peer
Date: Thu, 2 Sep 2021 10:29:32 +0700	[thread overview]
Message-ID: <sgpgeu$1ogj$1@gioia.aioe.org> (raw)
In-Reply-To: 57c7ca69-cc99-45ae-b494-580536a99ef4n@googlegroups.com

On 02/09/2021 01.58, Juan Rayas wrote:
> Hi,
> 
>   I am teaching myself Ada and tried to create a simple program that sends an email if today's date equals my birthday :).
> 
>   I am using Gnat Studio 2021, Community edition, Ubuntu 20.0.4. I downloaded, built and installed AWS. I am sending the email as follows:
> 
> procedure SendMail is
>        Status : AWS.SMTP.Status;
>        Auth   : aliased constant SMTP.Authentication.Plain.Credential :=
>          SMTP.Authentication.Plain.Initialize
>            ("myAccount", "myPassword");
>        Isp : SMTP.Receiver;
> 
>     begin
>        New_Line;
>        Isp :=
>          SMTP.Client.Initialize
>            ("smtp.gmail.com", Port => 465,
>             Credential             => Auth'Unchecked_Access);
> 
>        SMTP.Client.Send
>          (Isp, From => SMTP.E_Mail ("Me", "myAccount"),
>           To        => SMTP.E_Mail ("Me", "myAccount"),
>           Subject   => "AWS test",
>           Message   => "This is a test",
>           Status    => Status);
> 
>        if not SMTP.Is_Ok (Status) then
>           Text_IO.Put_Line
>             ("Can't send message :" & SMTP.Status_Message (Status));
>        end if;
>     end SendMail;
> 
> myAccount and myPassword are removed for the purposes of  this post.
> 
> When I run my program, the SendEmail procedure fails with the following message:
> 
> raised AWS.SMTP.SERVER_ERROR : raised AWS.NET.SOCKET_ERROR : Receive : Socket closed by peer
> 
> Does anyone know how to fix this when using the gmail server? Or perhaps I am using AWS incorrectly?
> 
> Thanks,
> Juan
> 

Use a public email test server for testing program. Places like these: 
https://www.bing.com/search?form=MOZLBR&pc=MOZI&q=email+test+servers. It 
will show what's the received and sent responses.
The Gmail server marked your message as spam or worse and simply ignored 
your message.

  parent reply	other threads:[~2021-09-02  3:29 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 [this message]
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
replies disabled

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