I still get the same thing when trying to attach a pdf doc, just a characters within the email.
Here is my code if it helps
--------------------------
Dim email As New DotNetOpenMail.EmailMessage
Dim smtpServer As New DotNetOpenMail.SmtpServer(EmailServer)
Dim token As New DotNetOpenMail.SmtpAuth.SmtpAuthToken(EmailUserName, EmailPassword)
'Dim token As New DotNetOpenMail.SmtpAuth.LoginAuthToken(EmailUserName, EmailPassword)
smtpServer.SmtpAuthToken = token
Dim toAddr As New DotNetOpenMail.EmailAddress(ToEmail)
Dim fromAddr As New DotNetOpenMail.EmailAddress(FromEmail)
For Each obj As Object In m_CcList
Dim addr As EmailAddress = DirectCast(obj, EmailAddress)
If addr.Name <> "" Then
email.AddCcAddress(New DotNetOpenMail.EmailAddress(addr.Email, addr.Name))
Else
email.AddCcAddress(addr.Email)
End If
Next
If Not m_AttachmentData Is Nothing Then
Dim attachment As New DotNetOpenMail.FileAttachment(m_AttachmentData)
attachment.ContentType = m_AttachmentContentType
attachment.FileName = m_AttachmentName
email.AddRelatedAttachment(attachment)
End If
I've never tried putting an inline file as a "Related" attachment---it might work, but I don't know how widely it would be supported if it does. And I don't think I've never received an email like that, either, come to think of it.... Instead, I generally make them "Mixed", which makes them appear in the "files" area of the email.
The example here is how I usually do it, (under "An email with a PDF attachment"):
Hi-
Ok, I'm hoping that 0.5.8b fixes attachment
corruption for everybody.
Don't use a StringReader for non-text attachments---use a BinaryReader instead.
Cheers,
-Mike
I still get the same thing when trying to attach a pdf doc, just a characters within the email.
Here is my code if it helps
--------------------------
Dim email As New DotNetOpenMail.EmailMessage
Dim smtpServer As New DotNetOpenMail.SmtpServer(EmailServer)
Dim token As New DotNetOpenMail.SmtpAuth.SmtpAuthToken(EmailUserName, EmailPassword)
'Dim token As New DotNetOpenMail.SmtpAuth.LoginAuthToken(EmailUserName, EmailPassword)
smtpServer.SmtpAuthToken = token
Dim toAddr As New DotNetOpenMail.EmailAddress(ToEmail)
Dim fromAddr As New DotNetOpenMail.EmailAddress(FromEmail)
email.ToAddresses.Add(toAddr)
email.FromAddress = fromAddr
email.Subject = Me.Subject
email.BodyText = Me.Body
For Each obj As Object In m_CcList
Dim addr As EmailAddress = DirectCast(obj, EmailAddress)
If addr.Name <> "" Then
email.AddCcAddress(New DotNetOpenMail.EmailAddress(addr.Email, addr.Name))
Else
email.AddCcAddress(addr.Email)
End If
Next
If Not m_AttachmentData Is Nothing Then
Dim attachment As New DotNetOpenMail.FileAttachment(m_AttachmentData)
attachment.ContentType = m_AttachmentContentType
attachment.FileName = m_AttachmentName
email.AddRelatedAttachment(attachment)
End If
Return email.Send(smtpServer)
--------------------------
Hi-
I've never tried putting an inline file as a "Related" attachment---it might work, but I don't know how widely it would be supported if it does. And I don't think I've never received an email like that, either, come to think of it.... Instead, I generally make them "Mixed", which makes them appear in the "files" area of the email.
The example here is how I usually do it, (under "An email with a PDF attachment"):
http://dotnetopenmail.sourceforge.net/examples.html
If you want it as a related attachment, make sure you have a "cid" and that the content type is "application/pdf".
Cheers,
-Mike