Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
        Dim strSubject As String 'subject title
        Dim strBody As String 'Body of message
        Dim strBody3 As String 'Body of message
        Dim strBody4 As String 'Body of message
        Dim strBody5 As String 'Body of message
        Dim strBody6 As String 'Body of message
        Dim strBody7 As String 'Body of message
        Dim strSubject1 As String 'Subject line
        Dim strBody2 As String 'Body of Message

        strSubject = "Need Remote Pc Help" 'store subject in variable
        strBody = "Here is All the Information that you will need:" 'store body in variable
        strBody3 = txtName.Text
        strBody4 = txtAddress.Text
        strBody5 = txtPhone.Text
        strBody6 = txtProblem.Text
        strBody7 = txtIP.Text

        Dim mail As New System.Text.StringBuilder
        strSubject1 = "?subject=" & strSubject
   **     strBody2 = "&body=" & strBody & strBody3 & strBody4 & strBody5 & strBody6 & strBody7

        mail.Append("mailto:backstback@hotmail.com") 'email address

        mail.Append(strSubject1) 'subject
        mail.Append(strBody2) 'body of message
        SendMail(mail.ToString)
    End Sub

When i make this program it goes to the email client but it puts they Body content all in one line with no spaces at all, is there a way in the code too make it return or enter onto a new line for each item?

Recommended Answers

All 3 Replies

Add Environment.NewLine after each body line.
A better way would be to do this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
    Dim strSubject As String 'subject title
    Dim strBody As String 'Body of message

    strSubject = "Need Remote Pc Help" 'store subject in variable

    'store body in variable
    strBody = "Here is All the Information that you will need:" & Environment.NewLine
    strBody &= txtName.Text & Environment.NewLine
    strBody &= txtAddress.Text & Environment.NewLine
    strBody &= txtPhone.Text & Environment.NewLine
    strBody &= txtProblem.Text & Environment.NewLine
    strBody &= txtIP.Text

    Dim mail As New System.Text.StringBuilder
    strSubject = "?subject=" & strSubject

    mail.Append("mailto:backstback@hotmail.com") 'email address

    mail.Append(strSubject) 'subject
    mail.Append(strBody) 'body of message
    SendMail(mail.ToString)
End Sub

That is a better way but still in the mail client it puts all the body onto one line

Ok. Try replacing Environment.NewLine with the HTML tag for linebreak: "<br />".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.