Ho trovato questo ma è per VB
codice:
Dim iMsg As New CDO.Message
Dim iBp As CDO.IBodyPart
Dim Stm As ADODB.Stream
Dim Stm2 As New ADODB.Stream
With iMsg
.To = "example@example.com"
.From = "example@example.com"
.Subject = "hello there"
.TextBody = "here is my xml file"
End With
' Open the XML file using the 2nd, temporary Stream object
With Stm2
.Open
.Type = adTypeText
.Charset = "UTF-8"
.LoadFromFile "c:\test.xml"
End With
' Now add the attachment to the message
Set iBp = iMsg.Attachments.Add
With iBp
.ContentMediaType = "text/xml; charset=""utf-8"""
.Charset = cdoUTF8
Set Stm = .GetDecodedContentStream
' Copy the XML file contents to the content stream
End With
Stm2.CopyTo Stm
Stm.Flush
' Save the file to check our work
iMsg.GetStream.SaveToFile "c:\test.eml", adSaveCreateOverWrite
però non ho idea di come inserirlo nel mio