VB - Zeilenumbruch im html-Body

  • VB.NET

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von queckjunior.

    VB - Zeilenumbruch im html-Body

    Hallo,

    ich sende aus einem Formular heraus eine Mail:

    Unter .htmlbody = ...... wird der Body zusammengesetzt. Wie bekomme ich hier einen zeilenumbruch rein? mit + vbNewLine + oder & vbNewLine &
    funktioniert das irgendwie nicht

    Quellcode

    1. Try
    2. Dim objOutlook As Object 'Outlook.Application
    3. Dim objOutlookMsg 'As Outlook.MailItem
    4. 'Dim objOutlookAttach ' As Outlook.Attachment
    5. ''Dim objOutlookAttach1 ' As Outlook.Attachment
    6. Dim empfaenger As String
    7. 'Erstellen der Outlook Session
    8. objOutlook = CreateObject("Outlook.Application")
    9. 'Erstellen der E-Mail
    10. objOutlookMsg = objOutlook.CreateItem(0)
    11. 'Empfänger zusammenbasteln
    12. empfaenger = MailketteTextBox.Text
    13. With objOutlookMsg
    14. .To = empfaenger
    15. .CC = ""
    16. .BCC = ""
    17. .Subject = "Kundenreklamation Projekt " & Pro_nummerTextBox.Text & " vom " & DatumDateTimePicker.Value
    18. .htmlbody = "Projektnummer " & Pro_nummerTextBox.Text & " Teileanzahl " & TeileanzahlTextBox.Text & " Reklamationsdatum " & DatumDateTimePicker.Value & " Reklamationsgrund " & reklamationsgrundRichTextBox.Text
    19. '//am Bildschirm anzeigen
    20. .Display()
    21. '.send()
    22. 'Attachment erstellen
    23. 'If RichTextBox1.Text <> "" Then 'Wenn ein Leerstring kommt gibt es einen Fehler
    24. ' objOutlookAttach = .Attachments.Add(RichTextBox2.Text)
    25. 'End If
    26. End With
    27. objOutlook = Nothing
    28. objOutlookMsg = Nothing
    29. Catch ex As Exception
    30. MessageBox.Show(ex.Message)
    31. End Try


    queckjunior
    Problem selbst gelöst. Das Wort .htmlbody am Zeilenanfang muss in .body umgewandelt werden. Dann funktioniert auch das & vbCrLf &.

    Quellcode

    1. .body = "Projektnummer " & Pro_nummerTextBox.Text & vbCrLf & "Teileanzahl " & TeileanzahlTextBox.Text & vbCrLf & "Reklamationsdatum " & DatumDateTimePicker.Value & vbCrLf & "Reklamationsgrund " & reklamationsgrundRichTextBox.Text


    queckjunior