Impossible to send an email with synapse lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- michastro · 2021-10-13 11:01 Hello, I try to send an email with synapse, but it doesn't work. I use this article:  https://wiki.freepascal.org/Synapse#Sending_email The SMTP.Login failed every time. My call is like that: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SendMail('m ylogin','mypwd','myadress','myadress','smtp.orange.fr','587','Hello'); Thanks for your help Michel ---------------------------------------------------------------------- Remy Lebeau · 2021-10-13 16:28 Quote from: michastro on October 13, 2021, 01:01:21 pmI try to send an email with synapse, but it doesn't work. Can you be more specific? Quote from: michastro on October 13, 2021, 01:01:21 pmThe SMTP.Login failed every time. In what way, exactly, does it fail? Are you getting an error message? What does it say? ---------------------------------------------------------------------- egsuh · 2021-10-13 19:38 Some mail servers didn’t work with Synapse. ---------------------------------------------------------------------- Remy Lebeau · 2021-10-13 20:53 Quote from: egsuh on October 13, 2021, 09:38:56 pmSome mail servers didn’t work with Synapse. That is not much of an explanation for WHY they don't work.  Does it send bad commands to them? Does it use outdated authentication they don't support? Are the credentials just wrong?  There are a lot of reasons why an SMTP login might fail. ---------------------------------------------------------------------- egsuh · 2021-10-15 08:38 QuoteThat is not much of an explanation for WHY they don't work.  Does it send bad commands to them? Does it use outdated authentication they don't support? Are the credentials just wrong?  There are a lot of reasons why an SMTP login might fail. You are right. I wanted to say I tried same thing, and some mail servers did work, while others did not. I don't know why yet. I'll continue to try to find out the reason (and possible solution). Sorry that I do not have answer.  But the original poster may try other mail servers for now, and when someone find out the reason then I hope it is shared. ---------------------------------------------------------------------- trev · 2021-10-15 10:08 Port 587 is for encrypted SMTP communications. See RFC8314 for the necessary details. ---------------------------------------------------------------------- devEric69 · 2021-10-15 11:04 AFAIK, overall, port 587 should allow to encrypt the sending of emails-messages using the TLS protocol (but this is not an obligation), if the handshake between the client and the server is verified\checked as being compatible with TTLS protocol RFC8314 compliance, on both sides. If TLS cannot be used (because the server - in fact - doesn't offer this TLS ability on its port 587, or because the client doesn't respect the TLS protocol), then the server downgrades the asked TLS towards simple SMTP: in this case, the email is nevertheless sent, but not encrypted. ---------------------------------------------------------------------- tr_escape · 2021-10-15 12:11 Maybe this thread also can help you: https://forum.lazarus.freepascal.org/index.php?topic=40237.0 Also alternatively you should try on gmail less secure smtp account for POC ---------------------------------------------------------------------- Remy Lebeau · 2021-10-15 15:27 Quote from: devEric69 on October 15, 2021, 01:04:37 pmAFAIK, overall, port 587 should allow to encrypt the sending of emails-messages using the TLS protocol (but this is not an obligation), if the handshake between the client and the server is verified\checked as being compatible with TTLS protocol RFC8314 compliance, on both sides. If TLS cannot be used (because the server - in fact - doesn't offer this TLS ability on its port 587, or because the client doesn't respect the TLS protocol), then the server downgrades the asked TLS towards simple SMTP: in this case, the email is nevertheless sent, but not encrypted. More accurately, the client connects to port 587 unencrypted, checks the server's capabilities, and if desired and possible then requests the server to upgrade to TLS. If the handshake fails, the connection is closed. ---------------------------------------------------------------------- madref · 2021-10-15 15:59 I don't use synapse I use this function and it sends mail including an attachment to anywhere Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses smtpsend,     mimemess, mimepart;  function VerzendMailMetBijlage (Const MailAan, Onderwerp: String; Inhoud: TStrings; Bijlage: String): Boolean;var Mime : TMimeMess;    P : TMimePart;    B : Boolean;begin  Mime:=TMimeMess.Create;  try    // Zet enkele headers van het bericht.    Mime.Header.ToList.Text := MailAan;    Mime.Header.ReplyTo := SenderName + '<' + SenderEMail + '>';    Mime.Header.Subject := Onderwerp;    Mime.Header.From := SenderName + '<' + SenderEMail + '>';    // Maak een multipart deel aan.    P := Mime.AddPartMultipart('mixed',Nil);    // Als eerste deel de tekst van de mail toevoegen.    Mime.AddPartHTML (Inhoud,P);    // Alle bijlagen toevoegen.    Mime.AddPartBinaryFromFile (Bijlage,P);    // Na deze code is het MIME bericht klaar. Het bericht dat verzonden    // moet worden, kan nu samengesteld worden door EncodeMessage op te roepen,  // en met SendToRaw te versturen:    // Bericht samenstellen    Mime.EncodeMessage;    // En verzenden met SendToRaw    B := SendToRaw(SenderName + '<' + SenderEMail + '>', MailAan,              smtpHost, Mime.Lines, smtpUser, smtpPassword);    Result := B;  finally    Mime.Free;  end;end;     // VerzendMailMetBijlage