bruno-pere Posted March 1, 2013 Share Posted March 1, 2013 Hi! Complementing my sample about printing HTML from Dataset using UniURLFrame. For a basic reporting solution. Now I share a code to send the HTML using Indy, tested with version 10.5.8. My other topic is (Dataset To HTML - Report): http://forums.unigui.com/index.php?/topic/2696-dataset-to-html-report/ The code to send email is threaded and works with Exchange and Google servers. May contain errors. Sorry. Use at your own risk. How to use? 1) Download the pas file attached (the thread); 2) Download the precompiled OpenSSL libraries for your correct windows version 32/64 bits: Author: Arvid Winkelsdorf, digivendo GmbH, www.digivendo.com for The Indy Project, www.indyproject.org I have them here if anyone wants. Save the files libeay32.dll and ssleay32.dll inside the folder of your application. 3) Code like this to send an HTML email: ThdSM := TThdSendMail.Create; ThdSM.EmailData.edSMTPUserName := 'account@domain.com.br'; ThdSM.EmailData.edSMTPPassword := 'myhiddenpassword'; ThdSM.EmailData.edSMTPServer := 'theexchangeserver'; ThdSM.EmailData.edSMTPPort := 587; ThdSM.EmailData.edSSLConnection := true; ThdSM.EmailData.edUseTLS := utUseExplicitTLS; ThdSM.EmailData.edSenderEmail := ThdSM.EmailData.edSMTPUserName; ThdSM.EmailData.edSenderApp := 'Sender Information'; ThdSM.EmailData.edToEmail := 'recipient1,recipient2,recipient3'; ThdSM.EmailData.edSubject := 'subject'; ThdSM.EmailData.edBody.Text := ToHTML.HTML.Text; // THE HTML CONTENT ThdSM.EmailData.edPriority := mpNormal; ThdSM.EmailData.edTimeOut := 15000; // 15 segundos // run thread, send mail ThdSM.Start; // ThdSM.FreeOnTerminate is set true inside create, so we don't need to free here Attention!!!! Inside the ThdSendMail thread the code is currently configured to work with Exchange servers, to use google or other configurations you should change some properties like: SSLHandler.SSLOptions.Method := sslvTLSv1; SSLHandler.SSLOptions.Mode := sslmClient; and maybe port But works with gmail too, tested. I just don't have the correct config now. Bye! Bruno UnitThdSendMail.zip 3 Quote Link to comment Share on other sites More sharing options...
albertovesx Posted March 1, 2013 Share Posted March 1, 2013 Thank you for share. Quote Link to comment Share on other sites More sharing options...
molla2005b Posted March 2, 2013 Share Posted March 2, 2013 tnx 4 share.hope for new success Quote Link to comment Share on other sites More sharing options...
stone feng Posted March 3, 2013 Share Posted March 3, 2013 Thank you. Quote Link to comment Share on other sites More sharing options...
bruno-pere Posted March 4, 2013 Author Share Posted March 4, 2013 Hope you enjoy!!! I lost an entire day trying a lot of implementations and combinations before it worked. Bye! Bruno 1 Quote Link to comment Share on other sites More sharing options...
mhmda Posted April 29, 2013 Share Posted April 29, 2013 Hi, Could this: send an image inside the html body? Quote Link to comment Share on other sites More sharing options...
bruno-pere Posted April 30, 2013 Author Share Posted April 30, 2013 You need to change some code for this. Read here and then try to make the changes. http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_23104746.html http://stackoverflow.com/questions/14279211/sending-email-with-indy-9-with-an-embedded-picture Quote Link to comment Share on other sites More sharing options...
mhmda Posted May 2, 2013 Share Posted May 2, 2013 I'll thank you very much :- ) Quote Link to comment Share on other sites More sharing options...
fcarvalho4 Posted May 2, 2013 Share Posted May 2, 2013 why you don't use the idSMTP with OpenSSL? Quote Link to comment Share on other sites More sharing options...
bruno-pere Posted May 7, 2013 Author Share Posted May 7, 2013 The code is using idSMTP with OpenSSL. Bruno Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.