Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create email message
Message
From
19/10/2002 21:22:51
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Create email message
Miscellaneous
Thread ID:
00713250
Message ID:
00713250
Views:
51
Hi,

When I add + CHR(13)+CHR(10) to the email meassage I get an error.

System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040212): The transport lost its connection to the server.

Anyone have a solution?

Thanks in advance!!!!!!!!

I'am trying to create formatted lines in the body of the message.

Line 1
Line 2
Line 3
Line 4

most of the code follows:
If I comment out the +chr(13)+chr(10) IT WORKS!!!!!!

-
-
Dim myDataRow As DataRow
For Each myDataRow In NhD_Xml_Ds1.Listing
e_MailMessage.Text() = e_MailMessage.Text() + myDataRow("APN") + Chr(13) + Chr(10)

Next
'= = = = = = = = = = = = = =
Dim MyEmailMessage As String
MyEmailMessage = e_MailMessage.Text()
NhD_Xml_Ds1.WriteXml("C:\NHDXMLFile.xml", XmlWriteMode.WriteSchema)

'===================================================================
Dim oMsg As MailMessage = New MailMessage()
' TODO: Replace with sender e-mail address.
oMsg.From = "someone@mailserver.com"
' TODO: Replace with recipient e-mail address.
oMsg.To = "someone@mailserver.com"
oMsg.Subject = "Request for NHD Reports"
' SEND IN HTML FORMAT (comment this line to send plain text).
oMsg.BodyFormat = MailFormat.Html
'HTML Body (remove HTML tags for plain text).
oMsg.Body = MyEmailMessage
' ADD AN ATTACHMENT.
' TODO: Replace with path to attachment.
Dim sFile As String = "C:\nhdxmlfile.xml"
Dim oAttch As MailAttachment = New MailAttachment(sFile, MailEncoding.Base64)
oMsg.Attachments.Add(oAttch)
' TODO: Replace with the name of your remote SMTP server.
SmtpMail.SmtpServer = "mail.mailsever.com"
SmtpMail.Send(oMsg)
oMsg = Nothing
oAttch = Nothing
Next
Reply
Map
View

Click here to load this message in the networking platform