Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HTML Email
Message
De
31/07/2013 11:44:47
 
 
À
31/07/2013 09:30:41
Information générale
Forum:
ASP.NET
Catégorie:
Produits tierce partie
Titre:
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01579402
Message ID:
01579521
Vues:
40
>>>>>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform