From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,FREEMAIL_REPLY,NICE_REPLY_A autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?Bj=c3=b6rn_Lundin?= Newsgroups: comp.lang.ada Subject: Re: AWS.SMTP.Client secure mode Date: Mon, 6 Sep 2021 11:26:27 +0200 Organization: A noiseless patient Spider Message-ID: References: <30267029-4433-4f45-a409-debf68fb27ccn@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 6 Sep 2021 09:26:27 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="9525ee742ac7fd7c263806bdd9be51ef"; logging-data="31100"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kNXnddHCSL2gz8QBa952S" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 Cancel-Lock: sha1:av3QYHUF//hELkXCWpangCyChh4= In-Reply-To: <30267029-4433-4f45-a409-debf68fb27ccn@googlegroups.com> Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:62654 List-Id: 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