473,394 Members | 1,722 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,394 software developers and data experts.

Sending HTML from system.net.mail

I have a little piece of code that will create an e-mail message from a saved
..htm file and send it.
It seems to work well for just about everyone on the receiving end, except
for a few people that are running a SendMail server. They get the html
rendered as plain text in their Outlook 2003 client after POP'ing the message
off their server.

Here is the code I'm using:
Sub SendMail(ByVal sServer As String, ByVal sTo As String, ByVal sFrom
As String, ByVal sSubject As String, ByVal sBody As String)
Try
'setup variables
Dim client As New System.Net.Mail.SmtpClient(sServer)
Dim message As New System.Net.Mail.MailMessage(sFrom, sTo)
'setup message attributes
message.IsBodyHtml = True
message.Subject = sSubject
message.Body = sBody
message.BodyEncoding = System.Text.Encoding.ASCII
message.SubjectEncoding = System.Text.Encoding.ASCII
'send the mail
client.Send(message)
'cleanup variables
client = Nothing
message = Nothing
Catch ex As Exception
MsgBox("Address " & sTo & " is invalid." & vbCrLf & ex.Message)
End Try
End Sub

I've been looking at some of the posts from other users on this HTML render
issue and people are saying maybe go with an AlternateView. Is this really
necessary or is there a different encoding I could do instead?

Funny thing is that when the user sends the same HTML from Outlook to their
server, the client renders it just fine in HTML.
Oct 13 '06 #1
0 2959

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

Similar topics

9
by: savvy | last post by:
i'm trying to compile a simple console application for sending a mail, my main idea is to schedule it to a particular time for sending mails using the windows schedular task lateron. Therefore i...
2
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends -...
6
by: Eduardo Rosa | last post by:
Somebody knows how I queue email using .Net? thanks a lot
1
by: David Dvali | last post by:
Hello. I have a problem with sending Unicode text in mail message. So what I do: First of all I have some template file like this: ================================= <html> <head><title>Test...
6
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
2
by: ChrisA | last post by:
I'm sending email from my ASP.NET 1.1 app, and it works fine providing the BodyFormat of the System.Web.Mail.MailMessage is set to Text. If I change to Html format, it breaks. Here's the code: ...
7
by: Ray Booysen | last post by:
Hi all I'm sending email via ASP.NET in HTML mode. Each email has exactly one attachment and I do have full access to the SMTP server. However, if I send the email in HTML format, the...
11
jamesd0142
by: jamesd0142 | last post by:
'server address Dim client As New SmtpClient("imap.uk.aol.com", 143) 'username and password client.Credentials = New Net.NetworkCredential("my username", "mypassword") ...
7
by: undbund | last post by:
Hi I am creating a newsletter system. The software should run from desktop computer (localhost) but be able to send email to anyone on the internet. Can you guys give me some ideas on how to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.