Thursday, March 29, 2012

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@dotnet.itags.org.domain.com"
myMsg.To = "friend@dotnet.itags.org.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,
AlexYou 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
"Yukon@.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 = "friend@.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), t
he
> 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 h
ad
> tried using Outlook to send email using HTML format to external mailbox an
d
> it remains as HTML format.
> Hope that someone can enlighten me.
>
> Thanks In Advance,
> Alex
>
>
Hi Al,
I had tried that and it still get converted to plain text.
Thanks,
Alex
"Albert Pascual" <AlbertPascual@.discussions.microsoft.com> wrote in message
news:1F49F255-72D5-4E9E-BDA0-DA5FE449D4C5@.microsoft.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
>
> "Yukon@.nospam.nospam" wrote:
>

0 comments:

Post a Comment