473,395 Members | 1,670 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

HTML Email

I want to create a html email with c# and the class System.Web.Mail. The
assign html code is correct, but the produced email has a lot of strange
errors in the text.

there are ! in the text, spaces and new lines in the tags.

Is there any solution for this problem?
Thanks
Thomas
Mar 20 '06 #1
5 1871
Are you setting the BodyFormat to html, ie: message.BodyFormat =
MailFormat.Html ??

Mar 20 '06 #2
I would like to see some sample code.

We can not tell anything if we don't see the code.

Regards,
Lars-Inge Tønnessen
Siemens Medical - Norway
Mar 20 '06 #3
Here the C# code (.NET 1.1):

MailMessage msg = new MailMessage();
msg.From = sender;
msg.To = recipient;
msg.Headers.Add("Reply-To", _XMLHandler.getEmailData.sender);

// convert rtf 2 html and attach it as body to the mail and beautify it
string html = rtf2html.BeautifyHTML(rtf2html.ConvertRtf2Html(bod yFile),
_TDWidth);
msg.BodyFormat = MailFormat.Html;
msg.Body = html;

// attach enclosures
AttachEnclosuresToMail(msg);

// send mail
SmtpMail.Send(msg);

I convert a RTF document to a HTML document and add the result to the
msg.Body.

Thanks
Thomas Heiz

----- Original Message -----
From: "Lars-Inge Tønnessen (VJ# MVP)" <http://emailme.larsinge.com>
Newsgroups: microsoft.public.dotnet.languages.csharp
Sent: Monday, March 20, 2006 10:57 PM
Subject: Re: HTML Email

I would like to see some sample code.

We can not tell anything if we don't see the code.

Regards,
Lars-Inge Tønnessen
Siemens Medical - Norway

Mar 21 '06 #4
yes, i'm setting the BodyFormat to html but it doesn't work.

"Jason Hales" <ja*********@yahoo.com> wrote in message
news:11**********************@t31g2000cwb.googlegr oups.com...
Are you setting the BodyFormat to html, ie: message.BodyFormat =
MailFormat.Html ??

Mar 21 '06 #5
I had a similar problem.

The solution was to add some newlines ("\n") to my HTML text. If you format
a very long message as a single string with no line breaks in it, so mail
systems will mess with it during delivery and the result will be a corrupted
HTML message.

I updated my code to ensure that no line was longer than approximately 150
characters and the problem was resolved.

Hope this helps

Steve
"Thomas Heiz" <th*********@pentag.ch> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I want to create a html email with c# and the class System.Web.Mail. The
assign html code is correct, but the produced email has a lot of strange
errors in the text.

there are ! in the text, spaces and new lines in the tags.

Is there any solution for this problem?
Thanks
Thomas

Mar 21 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: philphanluvr | last post by:
How do I sent content of a PHP form via HTML email? For example, fields $name, $city, $state, $phone, $location to HTML: <p>Congratulations $name from $city, $state with the phone # $phone ....
4
by: ,hj | last post by:
From: ",hj" <webmaster@mail.com> Subject: Losing random characters in HTML email Date: 28 November 2003 17:21 I've narrowed down my code as much as I can so that I can show you this bug. The...
1
by: Benny Ng | last post by:
Hi, I have created a program that can send and receive email.I would like to know how can i give my program the ability to view html emails? It currently shows html email in html codes.Please...
2
by: Brett | last post by:
I have a client that wants to send HTML based email. Building and sending isn't a problem, but he wants to include a plain text link at the top of the email that will display if the user doesn't...
4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
2
by: akylitis | last post by:
Hello: Anyone have an opinion on the best way to formulate a dynamic HTML email? Thus far I have figured out that the only way to "build" the HTML prior to the email (I'm using System.Net.Mail)...
7
by: geek7 | last post by:
OK, I'm trying to create an email and when it sends the email, it mostly works except that there are '!' inserted at some spots. Checking the html source of the email, looks like they are...
6
by: patrice.fiset | last post by:
Hi all, When I send the html email, the only thing I receive is the tags (the html codes basically). I want to be able to see the email like a html page, what is wrong with my code? Here is a...
2
by: bthubbard | last post by:
Hello All, I am hoping to hear other people's suggestions and advice regarding this issue. Generating and sending a basic HTML email with Microsoft.Net is easy. I can throw some HTML together...
4
RJOent
by: RJOent | last post by:
I am adding a contact form on my website, and I would like to send an autoreply email in html. I can send one with php in simple text, but no clue how to add html. Please help! Here is my code...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.