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