Recent

Author Topic: Impossible to send an email with synapse  (Read 4179 times)

michastro

  • Newbie
  • Posts: 5
Impossible to send an email with synapse
« on: October 13, 2021, 01:01:21 pm »
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][+][-]
  1. SendMail('mylogin','mypwd','myadress','myadress','smtp.orange.fr','587','Hello');
Thanks for your help
Michel

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1312
    • Lebeau Software
Re: Impossible to send an email with synapse
« Reply #1 on: October 13, 2021, 06:28:17 pm »
I try to send an email with synapse, but it doesn't work.

Can you be more specific?

The SMTP.Login failed every time.

In what way, exactly, does it fail? Are you getting an error message? What does it say?
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

egsuh

  • Hero Member
  • *****
  • Posts: 1273
Re: Impossible to send an email with synapse
« Reply #2 on: October 13, 2021, 09:38:56 pm »
Some mail servers didn’t work with Synapse.

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1312
    • Lebeau Software
Re: Impossible to send an email with synapse
« Reply #3 on: October 13, 2021, 10:53:33 pm »
Some 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.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

egsuh

  • Hero Member
  • *****
  • Posts: 1273
Re: Impossible to send an email with synapse
« Reply #4 on: October 15, 2021, 10:38:05 am »
Quote
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.

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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Impossible to send an email with synapse
« Reply #5 on: October 15, 2021, 12:08:02 pm »
Port 587 is for encrypted SMTP communications. See RFC8314 for the necessary details.

devEric69

  • Hero Member
  • *****
  • Posts: 648
Re: Impossible to send an email with synapse
« Reply #6 on: October 15, 2021, 01:04:37 pm »
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.
« Last Edit: October 15, 2021, 02:53:17 pm by devEric69 »
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: Impossible to send an email with synapse
« Reply #7 on: October 15, 2021, 02:11:47 pm »
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

  • Hero Member
  • *****
  • Posts: 1312
    • Lebeau Software
Re: Impossible to send an email with synapse
« Reply #8 on: October 15, 2021, 05:27:53 pm »
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.

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.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Impossible to send an email with synapse
« Reply #9 on: October 15, 2021, 05:59:41 pm »
I don't use synapse I use this function and it sends mail including an attachment to anywhere
Code: Pascal  [Select][+][-]
  1. uses smtpsend,
  2.      mimemess, mimepart;
  3.  
  4.  
  5. function VerzendMailMetBijlage (Const MailAan, Onderwerp: String; Inhoud: TStrings; Bijlage: String): Boolean;
  6. var Mime : TMimeMess;
  7.     P : TMimePart;
  8.     B : Boolean;
  9. begin
  10.   Mime:=TMimeMess.Create;
  11.   try
  12.     // Zet enkele headers van het bericht.
  13.     Mime.Header.ToList.Text := MailAan;
  14.     Mime.Header.ReplyTo := SenderName + '<' + SenderEMail + '>';
  15.     Mime.Header.Subject := Onderwerp;
  16.     Mime.Header.From := SenderName + '<' + SenderEMail + '>';
  17.     // Maak een multipart deel aan.
  18.     P := Mime.AddPartMultipart('mixed',Nil);
  19.     // Als eerste deel de tekst van de mail toevoegen.
  20.     Mime.AddPartHTML (Inhoud,P);
  21.     // Alle bijlagen toevoegen.
  22.     Mime.AddPartBinaryFromFile (Bijlage,P);
  23.     // Na deze code is het MIME bericht klaar. Het bericht dat verzonden
  24.     // moet worden, kan nu samengesteld worden door EncodeMessage op te roepen,
  25.     // en met SendToRaw te versturen:
  26.     // Bericht samenstellen
  27.     Mime.EncodeMessage;
  28.     // En verzenden met SendToRaw
  29.     B := SendToRaw(SenderName + '<' + SenderEMail + '>', MailAan,
  30.               smtpHost, Mime.Lines, smtpUser, smtpPassword);
  31.     Result := B;
  32.   finally
  33.     Mime.Free;
  34.   end;
  35. end;     // VerzendMailMetBijlage        
  36.  
  37.  
  38.  
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

 

TinyPortal © 2005-2018