Hi, I just started using OpenSMTP and it seems to be exactly what I was looking for! Thanks guys! However, I am having a problem and perhaps someone can help me. When I send a message using OpenSMTP the body text is not formatted correctly - it appears that all the whitespace characters have been removed. When I send the same message, same setup, except us the .NET MailMessage components the message sends fine.
I believe I am probably just not setting some property and I have tried to figure out which one but to no avail. My next step is to go through the source code, however I thought someone might be able to solve the problem quickly! Thanks!
Smoke
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please post the code you use when you receive this error. This will help us identify the bug.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-03-24
Sorry, for not posting this originally. Thanks for any help!
'##SUMMARY Method to actually send the mail
Private Function SendMailHelper(ByVal recipient As String, ByVal sender As String, ByVal subject As String, ByVal body As String, ByVal attachmentsPath As String) As Boolean
Dim objMessage As MailMessage
Dim objServer As Smtp
Dim strFiles() As String
Dim strCurrentFile As String
'instantiate the server
objServer = New Smtp(ConfigurationSettings.AppSettings.Item("Server"), 25)
'instantiate the message
objMessage = New MailMessage()
'setup the properties
objMessage.From = New EmailAddress(sender)
objMessage.Subject = subject
objMessage.Body = body
objMessage.AddRecipient(recipient, AddressType.To)
'get the attachments and add them to the message
strFiles = Directory.GetFiles(Me.Context.Request.PhysicalApplicationPath & attachmentsPath)
For Each strCurrentFile In strFiles
'attach the file to the message
objMessage.AddAttachment(strCurrentFile.Trim())
Next
'send the message
objServer.SendMail(objMessage)
'return result
Return True
End Function
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I just started using OpenSMTP and it seems to be exactly what I was looking for! Thanks guys! However, I am having a problem and perhaps someone can help me. When I send a message using OpenSMTP the body text is not formatted correctly - it appears that all the whitespace characters have been removed. When I send the same message, same setup, except us the .NET MailMessage components the message sends fine.
I believe I am probably just not setting some property and I have tried to figure out which one but to no avail. My next step is to go through the source code, however I thought someone might be able to solve the problem quickly! Thanks!
Smoke
Please post the code you use when you receive this error. This will help us identify the bug.
Sorry, for not posting this originally. Thanks for any help!
'##SUMMARY Method to actually send the mail
Private Function SendMailHelper(ByVal recipient As String, ByVal sender As String, ByVal subject As String, ByVal body As String, ByVal attachmentsPath As String) As Boolean
Dim objMessage As MailMessage
Dim objServer As Smtp
Dim strFiles() As String
Dim strCurrentFile As String
'instantiate the server
objServer = New Smtp(ConfigurationSettings.AppSettings.Item("Server"), 25)
'setup logon credentials
objServer.Username = ConfigurationSettings.AppSettings.Item("Username")
objServer.Password = ConfigurationSettings.AppSettings.Item("Password")
'instantiate the message
objMessage = New MailMessage()
'setup the properties
objMessage.From = New EmailAddress(sender)
objMessage.Subject = subject
objMessage.Body = body
objMessage.AddRecipient(recipient, AddressType.To)
'get the attachments and add them to the message
strFiles = Directory.GetFiles(Me.Context.Request.PhysicalApplicationPath & attachmentsPath)
For Each strCurrentFile In strFiles
'attach the file to the message
objMessage.AddAttachment(strCurrentFile.Trim())
Next
'send the message
objServer.SendMail(objMessage)
'return result
Return True
End Function
Thanks, I will test this when I get home tonight. What version of OpenSmtp are you using? Is it the latest?