Does anyone know how to fix this when using the gmail server? Or perhaps I am using AWS incorrectly?
Does anyone know how to fix this when using the gmail server?
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
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
Most mail servers do not accept unencrypted connections.
port 465 wants a TLS connection.
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message news:sgol48$r20$1@gioia.aioe.org...
...
Most mail servers do not accept unencrypted connections.
That's news to me, as my mail server (you know, the one that runs
Ada-Comment and the other ARG lists) doesn't support encrypted connections.
I don't have any problem sending to GMail (I send copies of most of my personal mail there). Something else must be wrong.
On 2021-09-03 00:19, Randy Brukardt wrote:
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:sgol48$r20$1@gioia.aioe.org...
...
Most mail servers do not accept unencrypted connections.
That's news to me, as my mail server (you know, the one that runs
Ada-Comment and the other ARG lists) doesn't support encrypted connections. >> I don't have any problem sending to GMail (I send copies of most of my
personal mail there). Something else must be wrong.
The question is with what settings. There are hundreds of combinations
of Port x unencrypted|StartTLS|TLS x authentication method.
The port 465 was intended for TLS, then it was depreciated. Then they >introduced other ports. Legacy mail servers pissed that all on etc.
From experience, getting a SMTP client working is real pain.
On Fri, 3 Sep 2021 09:32:27 +0200, "Dmitry A. Kazakov" <mai...@dmitry-kazakov.de> wrote:Hi all,
On 2021-09-03 00:19, Randy Brukardt wrote:
"Dmitry A. Kazakov" <mai...@dmitry-kazakov.de> wrote in message
news:sgol48$r20$1...@gioia.aioe.org...
...
Most mail servers do not accept unencrypted connections.
That's news to me, as my mail server (you know, the one that runs
Ada-Comment and the other ARG lists) doesn't support encrypted connections.
I don't have any problem sending to GMail (I send copies of most of my
personal mail there). Something else must be wrong.
The question is with what settings. There are hundreds of combinations
of Port x unencrypted|StartTLS|TLS x authentication method.
The port 465 was intended for TLS, then it was depreciated. Then they >introduced other ports. Legacy mail servers pissed that all on etc.
From experience, getting a SMTP client working is real pain.he is better off using his own provider's mail server on port 25, it
will accept username/password as authentication.
In all cases, I get the following error:
Can't send message :530 5.7.0 Must issue a STARTTLS command first. u7sm5705829pju.13 - gsmtp
The problem is I don't know how to send the STARTTLS command with AWS. Anyone know how?
On Friday, September 3, 2021 at 1:59:33 AM UTC-7, Doctor Who wrote:indicated in https://docs.adacore.com/aws-docs/aws/working_with_mails.html.
On Fri, 3 Sep 2021 09:32:27 +0200, "Dmitry A. Kazakov"Hi all,
<mai...@dmitry-kazakov.de> wrote:
On 2021-09-03 00:19, Randy Brukardt wrote:he is better off using his own provider's mail server on port 25, it
"Dmitry A. Kazakov" <mai...@dmitry-kazakov.de> wrote in message
news:sgol48$r20$1...@gioia.aioe.org...
...
Most mail servers do not accept unencrypted connections.
That's news to me, as my mail server (you know, the one that runs
Ada-Comment and the other ARG lists) doesn't support encrypted connections.
I don't have any problem sending to GMail (I send copies of most of my
personal mail there). Something else must be wrong.
The question is with what settings. There are hundreds of combinations
of Port x unencrypted|StartTLS|TLS x authentication method.
The port 465 was intended for TLS, then it was depreciated. Then they
introduced other ports. Legacy mail servers pissed that all on etc.
From experience, getting a SMTP client working is real pain.
will accept username/password as authentication.
thank you for your comments and responses.
I tried changing the port number to 25, using the default port number in the SMTP.Client.Initialize procedure, and using other port numbers such as 587. I even tried just initializing the SMT server and sending the email (without authentication) as
In all cases, I get the following error:
Can't send message :530 5.7.0 Must issue a STARTTLS command first. u7sm5705829pju.13 - gsmtp
The problem is I don't know how to send the STARTTLS command with AWS. Anyone know how?
My past experience was mostly with real-time embedded systems, so I don't have a lot of experience with email servers. I didn't expect this to be so difficult. Since this was mostly a toy to learn Ada, I may move on to other aspects of Ada for now.
Thanks for all your comments.
--Juan
On Fri, 3 Sep 2021 11:11:41 -0700 (PDT), Juan Rayasindicated in https://docs.adacore.com/aws-docs/aws/working_with_mails.html.
<juan.m...@gmail.com> wrote:
On Friday, September 3, 2021 at 1:59:33 AM UTC-7, Doctor Who wrote:
On Fri, 3 Sep 2021 09:32:27 +0200, "Dmitry A. Kazakov"Hi all,
<mai...@dmitry-kazakov.de> wrote:
On 2021-09-03 00:19, Randy Brukardt wrote:he is better off using his own provider's mail server on port 25, it
"Dmitry A. Kazakov" <mai...@dmitry-kazakov.de> wrote in message
news:sgol48$r20$1...@gioia.aioe.org...
...
Most mail servers do not accept unencrypted connections.
That's news to me, as my mail server (you know, the one that runs
Ada-Comment and the other ARG lists) doesn't support encrypted connections.
I don't have any problem sending to GMail (I send copies of most of my >> >> personal mail there). Something else must be wrong.
The question is with what settings. There are hundreds of combinations >> >of Port x unencrypted|StartTLS|TLS x authentication method.
The port 465 was intended for TLS, then it was depreciated. Then they
introduced other ports. Legacy mail servers pissed that all on etc.
From experience, getting a SMTP client working is real pain.
will accept username/password as authentication.
thank you for your comments and responses.
I tried changing the port number to 25, using the default port number in the SMTP.Client.Initialize procedure, and using other port numbers such as 587. I even tried just initializing the SMT server and sending the email (without authentication) as
Hi all,In all cases, I get the following error:
Can't send message :530 5.7.0 Must issue a STARTTLS command first. u7sm5705829pju.13 - gsmtp
The problem is I don't know how to send the STARTTLS command with AWS. Anyone know how?
My past experience was mostly with real-time embedded systems, so I don't have a lot of experience with email servers. I didn't expect this to be so difficult. Since this was mostly a toy to learn Ada, I may move on to other aspects of Ada for now.
Thanks for all your comments.you have to change mail server:
--Juan
Isp :=
SMTP.Client.Initialize
("smtp.gmail.com", Port => 465,
Credential => Auth'Unchecked_Access);
don't use gmail, use your provider mail server ...
Isp :=
SMTP.Client.Initialize
("smtp.gmail.com", Port => 465,
Credential => Auth'Unchecked_Access);
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.
self.server = smtplib.SMTP(host=self.server_details['host'],
port=self.server_details['port'])
self.server.ehlo()
self.server.starttls()
self.server.ehlo()
self.server.login\
(user=server_details['user'],
password=keyring.get_password\
('u3a-email', server_details['user']))
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 45:05:59 |
Calls: | 8,141 |
Calls today: | 4 |
Files: | 13,085 |
Messages: | 5,858,057 |