Recent

Author Topic: [Solved]How to send HTML e-mails with Synapse  (Read 11117 times)

gjpneac

  • New Member
  • *
  • Posts: 16
[Solved]How to send HTML e-mails with Synapse
« on: July 26, 2012, 09:40:12 am »
Hello,

Somebody can explain to me how to send HTML e-mails with Synapse or indicate me a complete example. With Indy 10 : OK

My resource : http://www.delphigroups.info/2/4/255615.html (the last answer) --> unsuccessfully with Synapse.
With Synapse, no error message but I don't receive the emitted e-mail. It is thus probably a problem of message's structure. The same file.hml is correctly received if it is sent by Indy 10.

Thank you. Regards.
« Last Edit: July 26, 2012, 11:34:54 am by gjpneac »

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: How to send HTML e-mails with Synapse
« Reply #1 on: July 26, 2012, 10:28:35 am »
Why don't you post the synapse program you used? The message you indicated isn't really a nicely formatted program source code.

Synapse has this info on how to structure HTML mail using MIME:
http://www.ararat.cz/synapse/doku.php/public:howto:mimeparts
this page gives an example and details on sending MIME mail
http://www.ararat.cz/synapse/doku.php/public:howto:tmimepart

There's also a synapsemail samle in the download area (contributed applications). Don't know if it does HTML mail...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

gjpneac

  • New Member
  • *
  • Posts: 16
Re: How to send HTML e-mails with Synapse
« Reply #2 on: July 26, 2012, 11:34:35 am »
Hi,

Thank for your answer,

Quote
Why don't you post the synapse program you used? The message you indicated isn't really a nicely formatted program source code.
Because supposing that my code is not erroneous, the only way to reproduce the breakdown is to supply my access codes to the smtp server that i use. But apparently, the benefit of the doubt is not an usuel attitude : the problem is inevitably between the chair and the keyboard.

Quote
Synapse has this info on how to structure HTML mail using MIME:
http://www.ararat.cz/synapse/doku.php/public:howto:mimeparts
this page gives an example and details on sending MIME mail
http://www.ararat.cz/synapse/doku.php/public:howto:tmimepart
Why do you think that I do not know use Mime-types/parts. I specify in my question that I send successfully the same e-mail with Indy ? We do not need to use the Mime-types/parts with Indy ?

It is an involuntarily (I hope) aggressive attitude.

On the other hand, it seems that certain smtp server raises problem with Synapse. And indeed with another SMTP server, it works.

Regards.
« Last Edit: July 26, 2012, 11:58:57 am by gjpneac »

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: [Solved]How to send HTML e-mails with Synapse
« Reply #3 on: July 26, 2012, 08:07:05 pm »
Never mind, I'm sure you'll find the problem.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Knipfty

  • Full Member
  • ***
  • Posts: 232
Re: [Solved]How to send HTML e-mails with Synapse
« Reply #4 on: July 26, 2012, 08:18:55 pm »
wow!
64-bit Lazarus 2.2.0 FPC 3.2.2, 64-bit Win 11

krzynio

  • Full Member
  • ***
  • Posts: 109
    • Krzynio's home page
Re: [Solved]How to send HTML e-mails with Synapse
« Reply #5 on: January 31, 2014, 05:52:16 pm »
The working example from my project:
Code: [Select]
function SendMail(server, port, mailfrom, user, pwd: string; ssl: boolean; mailto: string; body: TStringList): boolean;
var
  m: TMimemess;
  p: TMimepart;
begin
  Result:=False;
  m:=TMimemess.create;
  try
    p := m.AddPartMultipart('mixed', nil);
    m.AddPartHTML(body, p);
    m.header.from := MailFrom;
    m.header.tolist.add(MailTo);
    m.header.subject:='Message from my system';
    m.EncodeMessage;
    SendToRaw(mailfrom, mailto, server+':'+port, m.lines, user, pwd);
  finally
    m.free;
  end;
Debian 12.8 x64, / Windows 11 PL - latest updates
Lazarus 3.6

 

TinyPortal © 2005-2018