trichview.com Forum Index trichview.com
TRichView support forums
 

[Demo] Sending HTML email. Saving MIME-encoded files.

Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    trichview.com Forum Index -> Examples, Demos
    View previous topic :: View next topic  
Author Message
Sergey Tkachenko
Site Admin


Joined: 27 Aug 2005
Posts: 10706

PostPosted: Tue Sep 28, 2010 3:20 pm    Post subject: Reply with quote

Process OnWriteHyperlink event.
In this event, write:
Target := PChar(RVData.GetItemTag(ItemNo));
Make sure that rvoTagsArePChars is included in Options.

Update 2011-Oct-22:
For TRichView 13.3+, the code should be
Target := RVData.GetItemTag(ItemNo);
And rvoTagsArePChars is obsolete and does nothing.
Back to top
View user's profile Send private message Visit poster's website
Sergey Tkachenko
Site Admin


Joined: 27 Aug 2005
Posts: 10706

PostPosted: Wed May 09, 2012 10:12 am    Post subject: Reply with quote

A new demo using Indy is added (in Delphi\Indy folder).
The old demo was moved to Delphi\Indy.old.

Old demo:
This demo tricks Indy. Indy thinks that this is a plain text message, but the demo includes all HTML email codes in the plain text, so it is actually an HTML email.
This demo can be used with all versions of Indy (may be with some minor modifications) and Delphi. It requires thirdparty code (included) for base64 encoding.

New demo:
This demo uses Indy features to create an HTML email. It requires Indy 10+ (because Indy 9 did not allow nested mime sections, required for HTML emails).
This demo requires Delphi 2009 or newer (it was created in Delphi XE2)
Note: the new version of Indy allows creating HTML email even more easily, using TIdMessageBuilderHtml. I was not aware about this class when creating this demo. Nevertheless, the results of this demo and of TIdMessageBuilderHtml must be identical.
Back to top
View user's profile Send private message Visit poster's website
PioPio



Joined: 18 Feb 2013
Posts: 17

PostPosted: Sat Mar 02, 2013 11:28 pm    Post subject: Reply with quote

Sergey Tkachenko wrote:
A new demo using Indy is added (in Delphi\Indy folder).

New demo:
This demo uses Indy features to create an HTML email. It requires Indy 10+ (because Indy 9 did not allow nested mime sections, required for HTML emails).
This demo requires Delphi 2009 or newer (it was created in Delphi XE2)
Note: the new version of Indy allows creating HTML email even more easily, using TIdMessageBuilderHtml. I was not aware about this class when creating this demo. Nevertheless, the results of this demo and of TIdMessageBuilderHtml must be identical.


I ran this example but it seems the email sent doesn't take into account the Font name and the attributes, Bold, Italic, Underline (I haven't checked the alignment options).

Is there a way to fix this ?

Many thanks

Pio Pio
Back to top
View user's profile Send private message
Sergey Tkachenko
Site Admin


Joined: 27 Aug 2005
Posts: 10706

PostPosted: Sun Mar 03, 2013 6:29 am    Post subject: Reply with quote

All font attributes must be taken into account.
Please send me step-by-step instructions how to reproduce the problem.
Back to top
View user's profile Send private message Visit poster's website
PioPio



Joined: 18 Feb 2013
Posts: 17

PostPosted: Sun Mar 03, 2013 10:25 am    Post subject: Reply with quote

Sergey Tkachenko wrote:
All font attributes must be taken into account.
Please send me step-by-step instructions how to reproduce the problem.


Hello Sergey,

I opened the example SendMail in the folder Indy and ran it. The email was sent successfully but the text is in Comic Sans MS in TRichViewEdit1 and in the email is a different one.

I made then another test, amended TVStyle.TextStyles[1].size=20 and ran the example again. The email was sent successfully again but the size didn't change in the email.

Many thanks


Pio Pio
Back to top
View user's profile Send private message
Sergey Tkachenko
Site Admin


Joined: 27 Aug 2005
Posts: 10706

PostPosted: Sun Mar 03, 2013 12:28 pm    Post subject: Reply with quote

Please run this demo and send a test email to richviewgmailcom
Back to top
View user's profile Send private message Visit poster's website
PioPio



Joined: 18 Feb 2013
Posts: 17

PostPosted: Sun Mar 03, 2013 12:34 pm    Post subject: Reply with quote

Sergey Tkachenko wrote:
Please run this demo and send a test email to richviewgmailcom


Message was sent.

Thanks and regards,


Pio Pio
Back to top
View user's profile Send private message
Sergey Tkachenko
Site Admin


Joined: 27 Aug 2005
Posts: 10706

PostPosted: Thu Mar 21, 2013 4:46 pm    Post subject: Reply with quote

I think I should post an answer here too.

TRichView.SaveHTMLToStreamEx uses named CSS classes to produce a clean and compact HTML code. Such HTML is shown correctly in desktop email clients. However, many online email clients (including the most popular ones) have problems with such HTML code - text and paragraph attributes are lost.

Solution:
1) Use SaveHTMLToStream instead of SaveHtmlToStreamEx. It produces basic HTML code without CSS.
Cons: only basic text and paragraph attributes are supported.
or
2) Include rvsoInlineCSS in the Options parameter of SaveHtmlToStreamEx. This will produce much larger HTML code, however, the problem will be solved.
Back to top
View user's profile Send private message Visit poster's website
MagicTom



Joined: 15 Sep 2005
Posts: 3

PostPosted: Sat Mar 22, 2014 11:54 am    Post subject: Mail in Database Reply with quote

Hello Sergey,
how would save the received mails in a database or write a new mail to a database?

Thomas
Back to top
View user's profile Send private message
Sergey Tkachenko
Site Admin


Joined: 27 Aug 2005
Posts: 10706

PostPosted: Tue Mar 25, 2014 10:41 am    Post subject: Reply with quote

Sorry, these tasks are beyond the scope of our demos.
This demo only shows how to convert TRichViewEdit content to HTML email, and how to send this email using Indy.
It does not even show how to load HTML email in TRichViewEdit.

A very simple but functional email client demo is created using CleverComponents: http://www.trichview.com/forums/viewtopic.php?t=4123
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    trichview.com Forum Index -> Examples, Demos All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group