Wrapping Text when using MailMessage

G

Guest

Working in asp.net I send out an email using the following Code:

Dim cdoMsg As New System.Web.Mail.MailMessage

Dim strEmailBCC As String = ""
strEmailBCC =
System.Configuration.ConfigurationSettings.AppSettings(CONFIG_EMAILBCC)

Try
With cdoMsg
.From = pvstrFromEmail
.To = pvstrToEmail
.Body = pvstrBody
.Subject = pvstrSubject
If Len(strEmailBCC) > 0 Then
.Bcc = strEmailBCC
End If
End With

'Leave SmtpServer blank to use the default (Windows 2000) server
System.Web.Mail.SmtpMail.SmtpServer = pvstrSMTPServer

'*** Either of these will probably do it
'cdoSender.Send(fromEmail, toEmail, strSubject, body)
System.Web.Mail.SmtpMail.Send(cdoMsg)

My problem is that when I receive the email in Outlook 2003 the text in the
message is "wrapped" - see below:

Name: Mr Richard Test
Email: (e-mail address removed)
Contact No: 06465 1

---------- Start of Itinerary ----------
Locator: SJP0JA

Flight Details
Ticket Delivery: E-ticket
Dispatch Date: 13/12/2005
Cost: GBP 370.60

Sector: 1
Class: Economy
Airline Name: British Airways
Flight Number: BA302
Depart From: London Heathrow (LHR)
Departure Terminal: 4
Destination: Paris Charles De Gaulle (CDG) Arrival Terminal: 1 Departure
Date: 09/02/2006, 06:20 Arrival Date: 09/02/2006, 08:25

Sector: 2
Class:
Airline Name: British Airways
Flight Number: BA303
Depart From: Paris Charles De Gaulle (CDG) Departure Terminal: 1
Destination: London Heathrow (LHR)
Arrival Terminal: 4
Departure Date: 10/02/2006, 07:45
Arrival Date: 10/02/2006, 08:15


Parking Details
Departure Date: 09/02/2006
Drop Off Time (24 hr clock): 04:20
Return Date: 10/02/2006
Return Time: 08:15
Vehicle Make: Lamborghini
Vehicle Model: Diablo
Registration: D14 BLO
Colour: Yellow
Cost: GBP36.19

---------- End of Itinerary ----------

Billing Information
Cost Centre: 2
Project Code: 2
ID: 2
Department: OPS
Our Ref: BB


I have to click on the Format menu and then select the "unwrap Text" option.

My question is how do I send out this email so that it is already unwrapped?

I have read through the VS help and can't find anything. Is it a server
setting?

Any help would be much appreciated.

Cheers,
Rich.
 
A

Andrew Morton

Richard wrote:
My problem is that when I receive the email in Outlook 2003 the text
in the message is "wrapped" - see below:

Name: Mr Richard Test
Email: (e-mail address removed)
Contact No: 06465 1

---------- Start of Itinerary ----------
Locator: SJP0JA

Flight Details
Ticket Delivery: E-ticket
Dispatch Date: 13/12/2005
Cost: GBP 370.60

Sector: 1
Class: Economy
Airline Name: British Airways
Flight Number: BA302
Depart From: London Heathrow (LHR)
Departure Terminal: 4
Destination: Paris Charles De Gaulle (CDG) Arrival Terminal: 1
Departure Date: 09/02/2006, 06:20 Arrival Date: 09/02/2006, 08:25
<snip>

It looks to me like you need more VbCrLf in there to make it more like

Sector: 1
Class: Economy
Airline Name: British Airways
Flight Number: BA302

Departure details
===========
Depart From: London Heathrow (LHR)
Departure Terminal: 4
Destination: Paris Charles De Gaulle (CDG)

Arrival details
==========
Arrival Terminal: 1
Departure Date: 09/02/2006, 06:20
Arrival Date: 09/02/2006, 08:25

Andrew
 
C

Chris Dunaway

How are you constructing the E-Mail body in the pvstrBody variable?
Are in inserting vbCrLf characters?
 
G

Guest

I am inserting vbcrlf character at the edn of each line.

I have looked into this in more detail and I now believe it to be a problem
with Outlook. In Outlook you can make a setting to get rid of extra line
breaks in plain text messages.

See http://support.microsoft.com/default.aspx?scid=kb;en-us;287816

I am now investigating sending the emails in HTML format and using <BR>
instaed of vbcrlf.

Do most email applications read HTML eamils ok?
 
C

Chris Dunaway

They might read HTML messages, but many people will receive only plain
text e-mails because of the threat of malicious code that can be
embedded in an HTML message.

Have you tried constructing your message body without vbCrLf's and let
Outlook break the lines?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top