473,473 Members | 2,195 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MailMessage HTML body - Please Help Urgent

Hi,

I am having problem sending email to external mailbox using HTML format.
Following is a simplified code that I used to send the email.

Dim myMsg As New MailMessage
Dim htmlBody As String
htmlBody = "<HTML><BODY><A
HREF='http://www.microsoft.com'>Microsoft</A></BODY></HTML>"
myMsg.From = "me@domain.com"
myMsg.To = "fr****@yourdomain.com"
myMsg.Subject = "Testing HTML"
myMsg.BodyFormat = MailFormat.Html
myMsg.Body = htmlBody
System.Web.Mail.SmtpMail.SmtpServer = "smtpserver.domain.com"
System.Web.Mail.SmtpMail.Send(myMsg)

My SMTP server is an Exchange 2003 server with SP2. When using the same
code to send email to internal mailbox (with our Exchange Organization), the
HTML format was retained. However when email was sent out to external
mailbox (e.g. hotmail, yahoo, gmail), it was converted to plain text. I had
tried using Outlook to send email using HTML format to external mailbox and
it remains as HTML format.

Hope that someone can enlighten me.
Thanks In Advance,
Alex
Jan 5 '06 #1
2 2221
You don't need to put the HTML tag as a page. Do this and should work:

htmlBody = "<A HREF='http://www.microsoft.com'>Microsoft</A><BR>"

Cheers
Al
"Yu***@nospam.nospam" wrote:
Hi,

I am having problem sending email to external mailbox using HTML format.
Following is a simplified code that I used to send the email.

Dim myMsg As New MailMessage
Dim htmlBody As String
htmlBody = "<HTML><BODY><A
HREF='http://www.microsoft.com'>Microsoft</A></BODY></HTML>"
myMsg.From = "me@domain.com"
myMsg.To = "fr****@yourdomain.com"
myMsg.Subject = "Testing HTML"
myMsg.BodyFormat = MailFormat.Html
myMsg.Body = htmlBody
System.Web.Mail.SmtpMail.SmtpServer = "smtpserver.domain.com"
System.Web.Mail.SmtpMail.Send(myMsg)

My SMTP server is an Exchange 2003 server with SP2. When using the same
code to send email to internal mailbox (with our Exchange Organization), the
HTML format was retained. However when email was sent out to external
mailbox (e.g. hotmail, yahoo, gmail), it was converted to plain text. I had
tried using Outlook to send email using HTML format to external mailbox and
it remains as HTML format.

Hope that someone can enlighten me.
Thanks In Advance,
Alex

Jan 5 '06 #2
Hi Al,

I had tried that and it still get converted to plain text.
Thanks,
Alex

"Albert Pascual" <Al***********@discussions.microsoft.com> wrote in message
news:1F**********************************@microsof t.com...
You don't need to put the HTML tag as a page. Do this and should work:

htmlBody = "<A HREF='http://www.microsoft.com'>Microsoft</A><BR>"

Cheers
Al
"Yu***@nospam.nospam" wrote:
Hi,

I am having problem sending email to external mailbox using HTML format.
Following is a simplified code that I used to send the email.

Dim myMsg As New MailMessage
Dim htmlBody As String
htmlBody = "<HTML><BODY><A
HREF='http://www.microsoft.com'>Microsoft</A></BODY></HTML>"
myMsg.From = "me@domain.com"
myMsg.To = "fr****@yourdomain.com"
myMsg.Subject = "Testing HTML"
myMsg.BodyFormat = MailFormat.Html
myMsg.Body = htmlBody
System.Web.Mail.SmtpMail.SmtpServer = "smtpserver.domain.com"
System.Web.Mail.SmtpMail.Send(myMsg)

My SMTP server is an Exchange 2003 server with SP2. When using the same
code to send email to internal mailbox (with our Exchange Organization),
the
HTML format was retained. However when email was sent out to external
mailbox (e.g. hotmail, yahoo, gmail), it was converted to plain text. I
had
tried using Outlook to send email using HTML format to external mailbox
and
it remains as HTML format.

Hope that someone can enlighten me.
Thanks In Advance,
Alex

Jan 6 '06 #3

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

Similar topics

4
by: John Scott | last post by:
Hi There. I have a small c# problem. I am trying to create a dynamic email body. The body may be larger than the maximum number of characters a string can have (256?). I build the string like...
0
by: desi.american | last post by:
I'm using System.Web.Mail to send an email message from an ASP.NET web page. This is the main section of the code. //************* start code ***************************** string mailHost =...
4
by: Aren Cambre | last post by:
Why does SmtpMail.Send throw an exception if the MailMessage's BodyFormat = MailFormat.Html? I've searched all over the place and cannot find a solution anywhere. I am running this on Windows XP...
1
by: MickeBoy | last post by:
Hi all! I'm trying to send a HTML mail using the MailMessage class. Sending the message works fine, but there is something funny with the received message. I use the code below to generate and...
2
by: tma | last post by:
It appears that even though my mailmessage.bodyformat is set to mailformat.html, my html is being stripped out of the .body string in the code below. Anyone have any thoughts on why this happens? ...
5
by: Vlad | last post by:
We are trying to set MailMessage Content-Type to be text/calendar The following code has been used: string subject = "Calendar test 3"; MailMessage emailMessage = new MailMessage();...
1
by: Stu Lock | last post by:
Hi, I have an app that has beenusing the JMail COM component to generate emails. I would like to switch to the using the .Net 2.0 MailMessage object instead - as it is more portable. The...
1
by: Michel Couche | last post by:
Hello, I am starting the development of a newsletter The use of the class MailMessage of System.Net.Mail is quite straightforward for usual contact forms but my question here is "How can I...
2
by: =?Utf-8?B?Q2FwdGFpbiBEYXZlIQ==?= | last post by:
I wrote some code to send an email with two alternate views: 1) html 2) plain text All the html enabled email clients accept the html just fine and disregard the plain text version. However,...
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...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.