[Solved]How to send HTML e-mails with Synapse
lazarus / 31-LCL
----------------------------------------------------------------------
gjpneac · 2012-07-26 07:40
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.
----------------------------------------------------------------------
BigChimp · 2012-07-26 08:28
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...
----------------------------------------------------------------------
gjpneac · 2012-07-26 09:34
Hi,
Thank for your answer,
QuoteWhy 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.
QuoteSynapse 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.
----------------------------------------------------------------------
BigChimp · 2012-07-26 18:07
Never mind, I'm sure you'll find the problem.
----------------------------------------------------------------------
Knipfty · 2012-07-26 18:18
wow!
----------------------------------------------------------------------
krzynio · 2014-01-31 16:52
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;