Versand von E-Mail mit Bild im Body

  • VB.NET

Es gibt 3 Antworten in diesem Thema. Der letzte Beitrag () ist von Myrax.

    Versand von E-Mail mit Bild im Body

    Hallo,

    ich möchte eine E-Mail mit einem Bild im Body versenden. Nutzen tue ich Visual Studio 2010 und Outlook 2003. Mit Outlook ließe sich eine Vorlage erstellen, falls sowas überhaupt benötigt wird.

    Hab mit "System.Net.Mail" auch schon eine "nur text" Mail versendet.

    Vielen Dank schonmal
    Also, das ist mein Code bisher:

    VB.NET-Quellcode

    1. Public Module SendSMTP
    2. Public Sub SendSMTP(ByVal strFrom As String, ByVal strTo As String,
    3. ByVal strSubject As String, ByVal strBody As String,
    4. Optional ByVal strCC As String = "", Optional ByVal strAttachments As String = "")
    5. Dim insMail As New MailMessage(New MailAddress(strFrom), New MailAddress(strTo))
    6. With insMail
    7. .Subject = strSubject
    8. .Body = strBody
    9. If Not strCC.Equals(String.Empty) Then
    10. .CC.Add(New MailAddress(strCC))
    11. End If
    12. If Not strAttachments.Equals(String.Empty) Then
    13. Dim strFile As String
    14. Dim strAttach() As String = strAttachments.Split(";"c)
    15. For Each strFile In strAttach
    16. .Attachments.Add(New Attachment(strFile.Trim()))
    17. Next
    18. End If
    19. End With
    20. Dim smtp As New System.Net.Mail.SmtpClient
    21. smtp.Host = "meinSMTP.de"
    22. smtp.Port = 25
    23. smtp.Send(insMail)
    24. End Sub
    25. End Module


    Allerdings übergebe ich den Body ja als reinen String, kann man das abändern, um zB eine mit Outlook gespeicherte .htm oder .msg Datei zu verenden?