473,783 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Net.Mail.MailMe ssage.Alternate Views problem sending html and text

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, the plain-text-only email clients I've tried keep reading my plain
text email and formatting it in all kinds of crazy ways.

I tried sending the plain text version to an html enabled email client and
it read my plain text and it looked great!

I've tried dozens of ways. Here's my latest. It sends email just fine. But,
it's not telling the email clients what they need to know. Help! :-)
VB 2005

Dim mailFrom As MailAddress = Nothing
Dim mailTo As MailAddress = Nothing
Dim smtpClient As SmtpClient = Nothing
Dim altViewHTML As AlternateView = Nothing

Try

mailFrom = New MailAddress("jo *@joesdiner.com ")
mailTo = New MailAddress(txt TestData.Text.T oString())
altViewHTML = Net.Mail.Altern ateView.CreateA lternateViewFro mString("<b>thi s
will be bold in html</b>", System.Text.Enc oding.UTF8,
MediaTypeNames. Text.Html)

Using mailMessage As New MailMessage(mai lFrom, mailTo)

smtpClient = New SmtpClient("mai l.joesdiner.com ")
mailMessage.Sub ject = "test from joes diner"
mailMessage.Bod yEncoding = System.Text.Enc oding.ASCII
mailMessage.Bod y = "this is a test from joes diner"

altViewHTML.Tra nsferEncoding = Net.Mime.Transf erEncoding.Quot edPrintable

mailMessage.Alt ernateViews.Add (altViewHTML)

smtpClient.Send (mailMessage)

End Using

Catch ex As Exception

'handle error

Finally

If Not IsNothing(mailF rom) Then mailFrom = Nothing
If Not IsNothing(mailT o) Then mailTo = Nothing
If Not IsNothing(altVi ewHTML) Then altViewHTML = Nothing
If Not IsNothing(smtpC lient) Then smtpClient = Nothing

End Try

Aug 17 '07 #1
2 8815
On Fri, 17 Aug 2007 12:32:06 -0700, Captain Dave!
<da***********@ hawaiianair.com wrote:
>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, the plain-text-only email clients I've tried keep reading my plain
text email and formatting it in all kinds of crazy ways.

I tried sending the plain text version to an html enabled email client and
it read my plain text and it looked great!

I've tried dozens of ways. Here's my latest. It sends email just fine. But,
it's not telling the email clients what they need to know. Help! :-)
If a plain text mail client is not aware of MIME types, it will
display the entire e-mail message. Perhaps the text-only clients you
have tried don't know how to show only the plain text part of the
message.
Aug 17 '07 #2
Yes, I thought the same thing! :-)

Then, I saw an email from iTunes that did what I wanted and it displayed
correctly in the text email client. So, I'm wondering what trick they used.

Any ideas?

"Jack Jackson" wrote:
On Fri, 17 Aug 2007 12:32:06 -0700, Captain Dave!
<da***********@ hawaiianair.com wrote:
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, the plain-text-only email clients I've tried keep reading my plain
text email and formatting it in all kinds of crazy ways.

I tried sending the plain text version to an html enabled email client and
it read my plain text and it looked great!

I've tried dozens of ways. Here's my latest. It sends email just fine. But,
it's not telling the email clients what they need to know. Help! :-)

If a plain text mail client is not aware of MIME types, it will
display the entire e-mail message. Perhaps the text-only clients you
have tried don't know how to show only the plain text part of the
message.
Aug 17 '07 #3

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

Similar topics

0
2207
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 Message</title></head> <body> <p>Hello {0}</p>
34
18271
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow "127.0.0.1". 4. Authentication: "Anonymous access" only. 5. Outbound connection listen to TCP 25. Besides,
2
2680
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: Me.Msg = New System.Web.Mail.MailMessage With Me.Msg .To = "someToAddress"
1
4638
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 jmail component allowed me to set both an HTML body and a text body - this meant that if a users' email client didn't support html - the user would see the text only version with an html attachment. The MailMessage object only appears to have one...
7
4388
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 framework reports the following exception: "System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown
1
8627
by: pon | last post by:
Hi! Inline attachments (images) doesn't seem to work. I have a html-document that I know works fine. This works fine in another mailing-product for me. Not sure if to use attachment with dispositiontype inline or like in these snippet, alternativeview and linkedresource? Can anyone see whats wrong? Here are a snippet from my html-page: body { background-image: url(cid:back.gif); background-repeat: repeat-y;
1
3979
by: Roberto Rocco | last post by:
Hello, I'm using VS 2005 and I need to send a mail body which contains german umlauts (ä,ö,ü). When I receive the mail in Outlook 2003 (english operating system) I always get a '|' or other similar symbols instead of the expected umlaut. I'm using Sstem.Net.Mail and I already tried something like this: string body = "this is some sample äöüÄÖÜß HTML text";
3
2396
by: raj200809 | last post by:
when i m sending mail i received error from symantec Antivirus" Your email message was unable to be sent because your mail server rejected the message 550-5.7.1 the ip you’re using to send mail is not authorized" i have configure smtp server put 127.0.0.1 ip in relay and also put 127.0.0.1 ip in connection. using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing;
0
2160
by: anu b | last post by:
Now i am sending email to my friend using session variable... but my code is as below private bool SendEmail(string email) { try {
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
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 we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.