TheAnvilGroup
asked on
VB.NET generated email subject line contains tabs where spaces should be in Outlook 2007
Dim mail As New MailMessage
mail.Subject = BuildSubject(newsData)
mail.Body = "<table>..data..</table>"
mail.IsHTML = True
'Some other code
Dim smtp As New SmtpClient(_sMTPServer)
smtp.Port = 25
smtp.Send(mail)
Private Function BuildSubject(ByRef newsData As News) As String
Dim subject As New StringBuilder
subject.Append("ALERT - ")
subject.Append(CStr(newsDa ta.Passeng erCount))
subject.Append(" Traveller" & CStr(IIf(newsData.Passenge rCount > 1, "s", "")))
subject.Append(" present in ")
subject.Append(newsData.Co untryName)
subject.Append(" - Incident level: " & newsData.IncidentLevel.ToS tring())
subject.Append(" - Category: " & newsData.FullCategories)
subject.Append(" - ")
subject.Append(newsData.Su mmHeadline )
subject.Append(" - ")
subject.Append(newsData.Se archTypeID .ToString( ))
Return subject.ToString
End Function
When email is received in Outlook 2007 contains the following (note there is a tabl before 'strike' and before 'category'):
ALERT - 5 Travellers present in United Kingdom - Incident level: 2 - Category: Rail Delays/Disruption - UK: Eurostar running 'normally' despite strike - Proximity
Please help me in what is causing this and how to I get rid of this. Is this to do with Outlook, the email body text not having html tags or is this due to the colons in the subject line?
mail.Subject = BuildSubject(newsData)
mail.Body = "<table>..data..</table>"
mail.IsHTML = True
'Some other code
Dim smtp As New SmtpClient(_sMTPServer)
smtp.Port = 25
smtp.Send(mail)
Private Function BuildSubject(ByRef newsData As News) As String
Dim subject As New StringBuilder
subject.Append("ALERT - ")
subject.Append(CStr(newsDa
subject.Append(" Traveller" & CStr(IIf(newsData.Passenge
subject.Append(" present in ")
subject.Append(newsData.Co
subject.Append(" - Incident level: " & newsData.IncidentLevel.ToS
subject.Append(" - Category: " & newsData.FullCategories)
subject.Append(" - ")
subject.Append(newsData.Su
subject.Append(" - ")
subject.Append(newsData.Se
Return subject.ToString
End Function
When email is received in Outlook 2007 contains the following (note there is a tabl before 'strike' and before 'category'):
ALERT - 5 Travellers present in United Kingdom - Incident level: 2 - Category: Rail Delays/Disruption - UK: Eurostar running 'normally' despite strike - Proximity
Please help me in what is causing this and how to I get rid of this. Is this to do with Outlook, the email body text not having html tags or is this due to the colons in the subject line?
ASKER
There are no tabs in the string, I pasted the string into a hex editor and no 09 (tabs) appeared. I only recieve the tabs (09) when the email is in the Outlook 2007 outbox. The problem is that the spaces are being converted to tabs for some unknown reason.
I've been searching in Google for a while. This seems to be a problem with a lot of email-clients, not just Outlook. It only happens for long subject lines.
Also, In Outlook 2007, under Tools, Options, Mail Format (tab), Internet Format ... (button)
there is an option for automatic wrapping in plain text messages. Maybe this setting has something to do with it? The default wrapping length seems to be 76 characters.
Also, In Outlook 2007, under Tools, Options, Mail Format (tab), Internet Format ... (button)
there is an option for automatic wrapping in plain text messages. Maybe this setting has something to do with it? The default wrapping length seems to be 76 characters.
ASKER
The tabs appear a character position 69 and then counting from this position another 71 characters. Knowing this how to I solve this other than changing the email client configuration.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Will check setting on Exchange server and some other applications are also effected and the Exchange server was recently upgraded.
Return subject.ToString().Replace