Hi!
Inline attachments (images) doesn't seem to work. I have a html-document
that I know works fine. This works fine in another mailing-product for me.
Not sure if to use attachment with dispositiontype inline or like in these
snippet, alternativeview and linkedresource? Can anyone see whats wrong?
Here are a snippet from my html-page:
body { background-image: url(cid:back.gi f); background-repeat: repeat-y;
background-attachment: fixed}
Here are a snippet from my mailing-code:
Dim l_Message As New MailMessage()
l_Message.Subje ct = l_strSubject
l_Message.From = New MailAddress(m_s trFrom)
Dim l_RecipientsTo As MailAddressColl ection = l_Message.To
Dim l_RecipientsCc As MailAddressColl ection = l_Message.CC
If m_strSendTo.Len gth > 0 Then
For Each l_strAddressToI tem As String In
m_strSendTo.Tri mEnd().Split("; ".ToCharArray() )
l_RecipientsTo. Add(New
MailAddress(l_s trAddressToItem ))
Next
End If
If m_strCcTo.Lengt h > 0 Then
For Each l_strAddressCcI tem As String In
m_strCcTo.TrimE nd().Split(";". ToCharArray())
l_RecipientsCc. Add(New
MailAddress(l_s trAddressCcItem ))
Next
End If
l_Message.IsBod yHtml = True
l_Message.Prior ity = MailPriority.Hi gh
Dim avhtml As AlternateView =
AlternateView.C reateAlternateV iewFromString(l _strHTMLBodyTex t)
avhtml.ContentT ype.MediaType = "text/html"
avhtml.Transfer Encoding =
System.Net.Mime .TransferEncodi ng.QuotedPrinta ble
avhtml.ContentT ype.MediaType = "text/html"
Dim lr As LinkedResource = New
LinkedResource( m_strSMTPAttach ment) 'ms, "image/gif")
lr.ContentType. MediaType =
System.Net.Mime .MediaTypeNames .Image.Gif
lr.TransferEnco ding = Net.Mime.Transf erEncoding.Base 64
lr.ContentId = "back.gif"
lr.ContentType. Name = "back.gif"
lr.ContentLink = New Uri("cid:back.g if")
avhtml.LinkedRe sources.Add(lr)
l_Message.Alter nateViews.Add(a vhtml)
If l_strPlainTextB ody.Length > 0 Then
Dim avtext As AlternateView =
AlternateView.C reateAlternateV iewFromString(l _strPlainTextBo dy)
avtext.ContentT ype = New ContentType("te xt/plain")
avtext.ContentT ype.MediaType = "text/plain"
avtext.Transfer Encoding = TransferEncodin g.QuotedPrintab le
l_Message.Alter nateViews.Add(a vtext)
End If
m_MailClient = New SmtpClient(m_st rSMTPHost,
m_intSMTPHostPo rt)
m_MailClient.Cr edentials =
System.Net.Cred entialCache.Def aultCredentials
m_MailClient.En ableSsl = False
m_MailClient.Ti meout = 100000
m_MailClient.De liveryMethod = SmtpDeliveryMet hod.Network
m_MailClient.Se nd(l_Message)