Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / December 2005

Tip: Looking for answers? Try searching our database.

Wrapping Text when using MailMessage

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard - 07 Dec 2005 15:49 GMT
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: x@pop.com
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.
Andrew Morton - 07 Dec 2005 16:43 GMT
<snip code>
> My problem is that when I receive the email in Outlook 2003 the text
> in the message is "wrapped" - see below:
[quoted text clipped - 19 lines]
> 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
Chris Dunaway - 08 Dec 2005 15:14 GMT
How are you constructing the E-Mail body in the pvstrBody  variable?
Are in inserting vbCrLf characters?
Richard - 08 Dec 2005 15:29 GMT
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?

> How are you constructing the E-Mail body in the pvstrBody  variable?
> Are in inserting vbCrLf characters?
Chris Dunaway - 08 Dec 2005 16:22 GMT
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?
Richard - 08 Dec 2005 16:45 GMT
I haven't tried that Idea.
How would Outlook know where to break the lines?

> 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?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.