Last post Apr 24, 2008 03:49 PM by lynnbob
Apr 24, 2008 11:29 AM|lynnbob|LINK
On the confirmation of a booking, I'm sending an email using web.mail, however, I've got a bit of a problem with it. I'm returning a block of data from SQL so I'm retruning it as one string with ";" as line separators so when I'm in .net I can process
it. I'm then replacing ";" with a vbcrlf. If I use 1 vbcrlf the email text remains as one block. If I use 2 vbcrlf's I get a 2 lines between each line of text. I need to keep it in plain text so the mails can be easily read on all platforms.
Any help would be greatly appreciated
This is the code I've got
Dim oMail As New System.Web.Mail.MailMessage
Dim sSubject As String, sBody As String, sEmail As String
oMail.BodyFormat = MailFormat.Text
sSubject = "Confirmation"
sDetails = Replace(sDetails, ";", vbcrlf & vbcrlf)
sBody = sDetails & vbcrlf
oMail.To = "xxxx"
oMail.From = "xxxx"
SmtpMail.SmtpServer = "xxxxxx"
oMail.Priority = MailPriority.Normal
oMail.Subject = sSubject
oMail.Body = sBody
Apr 24, 2008 03:38 PM|Mikesdotnetting|LINK
Have you tried using Environment.NewLine insted of vbcrlf?
sDetails = Replace(sDetails, ";", Environment.NewLine)
Also, System.Web.Mail was deprecated with the advent of version 2.0 of the framework. You don't say which version you are working with, but if it's 2.0, you should be using System.Net.Mail.
Apr 24, 2008 03:49 PM|lynnbob|LINK
No I've not used environment.newline, I'll give it a try, I'm using .NET 1.1