Break line in mail body content phpmailer

To break a line in the body content of a PHPMailer email, you can use the \r\n or \n characters. Here are a few ways to do it:

  1. Using \r\n:

    $mail->Body = "This is the first line.\r\nThis is the second line.";

    This will create a new line between the two lines of text.

  2. Using \n:

    $mail->Body = "This is the first line.\nThis is the second line.";

    This will also create a new line between the two lines of text.

  3. Using HTML line breaks (<br>):

    $mail->Body = "This is the first line.<br>This is the second line.";

    This will create a new line between the two lines of text, and the email will be rendered with HTML formatting.

  4. Using PHP's nl2br() function:

    $mail->Body = nl2br("This is the first line.\nThis is the second line.");

    This will convert all newline characters (\n) to HTML line breaks (<br>), so the email will be rendered with HTML formatting.

Note that if you're using a plain text email (i.e., not HTML), the \r\n or \n characters will work as expected. However, if you're using an HTML email, you may want to use the HTML line breaks (<br>) or the nl2br() function to ensure that the email is rendered correctly.