From: "Björn Lundin" <b.f.lundin@gmail.com>
Subject: Re: AWS.SMTP.Client secure mode
Date: Mon, 6 Sep 2021 11:26:27 +0200 [thread overview]
Message-ID: <sh4ms3$ubs$1@dont-email.me> (raw)
In-Reply-To: <30267029-4433-4f45-a409-debf68fb27ccn@googlegroups.com>
Den 2021-09-05 kl. 05:20, skrev philip...@gmail.com:
>
> Has anyone ever got secure and authenticated AWS.SMTP.Client working? And if so, how did you do it?
>
Yes.
I use Amazon as mailer - like this. Shortened version so it might not
compile. I think you need the Ada.Directories.Set_Directory statement
just as I need it.
in the directory I set , I have the cert.pem I'd like to use
procedure Mail_Saldo is
Subject : constant String := "Some Subject";
use AWS;
SMTP_Server_Name : constant String :=
"email-smtp.eu-north-1.amazonaws.com";
Status : SMTP.Status;
begin
Ada.Directories.Set_Directory(/where/is/my/cet/sslcert");
declare
Auth : aliased constant SMTP.Authentication.Plain.Credential :=
SMTP.Authentication.Plain.Initialize
("AKFCAWS_IS_A_MAILSERVERT", "BOYbIsome-chars-from-amazomFDWW");
SMTP_Server : SMTP.Receiver := SMTP.Client.Initialize
(SMTP_Server_Name,
Port => 465,
Secure => True,
Credential => Auth'Unchecked_Access);
use Ada.Characters.Latin_1;
Msg : constant String := "Some MEssage";
Receivers : constant SMTP.Recipients := (
SMTP.E_Mail("A Mail Address",
"a.mail.address@gmail.com"),
-- SMTP.E_Mail("Another Mail Addresss",
"another.mail.address@gmail.co"));
begin
SMTP.Client.Send(Server => SMTP_Server,
From => SMTP.E_Mail ("A sender",
"Sender@gmail.com"),
To => Receivers,
Subject => Subject,
Message => Msg,
Status => Status);
end;
if not SMTP.Is_Ok (Status) then
Log (Me & "Mail_Saldo", "Can't send message: " &
SMTP.Status_Message (Status));
end if;
end Mail_Saldo;
---------------------------------
cert.pem looks like
sslcert $ cat cert.pem
-----BEGIN RSA PRIVATE KEY-----
....
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
...........
-----END CERTIFICATE-----
--
Björn
next prev parent reply other threads:[~2021-09-06 9:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-05 3:20 AWS.SMTP.Client secure mode philip...@gmail.com
2021-09-06 9:26 ` Björn Lundin [this message]
2021-09-07 2:20 ` philip...@gmail.com
2021-09-07 6:21 ` Björn Lundin
2021-09-07 20:40 ` philip...@gmail.com
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox