Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HTML Email
Message
From
31/07/2013 12:29:03
 
 
To
31/07/2013 11:44:47
General information
Forum:
ASP.NET
Category:
Third party products
Title:
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01579402
Message ID:
01579527
Views:
32
>>>>>>Hi,
>>>>>>
>>>>>>I've done a C#/WPF/SQL Server desktop application for a client and they now want to add in a way to create HTML emails and send them out to their customers.
>>>>>>
>>>>>>I've been figuring that the easiest way is to let them create the email using Word, then copy the email from Word into the body of my email (which gets sent using the SMTP client (SmtpClient client = new SmtpClient(smtpClient, smtpPortInt);)
>>>>>>
>>>>>>Is there maybe an alternative or easier way of doing this?
>>>>>>
>>>>>>I already have all the logic to send the emails within my application as the system does a fair bit of that, but with generated HTML text based on data in the database.
>>>>>>
>>>>>>Any ideas/suggestions welcome.
>>>>>
>>>>>
>>>>>Do you have access to a Rich Text Box? It will allow you to save a HTML in most cases.
>>>>
>>>>Thanks, I'll see if I do.
>>>
>>>You may also find this useful: http://msdn.microsoft.com/en-us/library/aa972129.aspx
>>
>>Thanks Rob,
>>
>>at first I couldn't work out why this would be useful, but I think I am understanding now. The RichTextBox actually stores the code in XAML so I will need to convert it to HTML when I need to use. Is that right?
>
>Right, the default WPF RichTextBox uses a FlowDocument (http://msdn.microsoft.com/en-us/library/system.windows.documents.flowdocument.aspx). You can select a TextRange from that and save it to other formats (http://msdn.microsoft.com/en-us/library/ms598701.aspx), but HTML is not one of those formats. You can use a XamlWriter to save the FlowDocument though and convert that to HTML. Craig's suggestion of using a third party control that has this functionality built in is probably the easier way to go though.

Thanks
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Reply
Map
View

Click here to load this message in the networking platform