phpmailerHow can I add a new line to the body of an email using PHPMailer?
Adding a new line to the body of an email using PHPMailer is a simple process. The following example code shows how to add a new line with a text message to the body of an email using PHPMailer:
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->Body = "Hello!\nThis is a new line.";
echo $mail->Body;
?>
The output of this code will be:
Hello!
This is a new line.
The code consists of the following parts:
- The
require
statement which includes the PHPMailerAutoload.php file. This file contains the necessary code for PHPMailer to work correctly. - The
$mail
variable which is an instance of thePHPMailer
class. - The
$mail->Body
statement which sets the body of the email. - The
echo
statement which prints out the body of the email.
For more information on how to use PHPMailer to send emails, see the PHPMailer documentation.
More of Phpmailer
- How do I use PHPMailer to attach a ZIP file?
- How can I use PHPMailer without SMTP secure?
- How can I configure PHPMailer to support Polish characters?
- How can I configure PHPMailer to work with GoDaddy?
- How do I view the log for my PHPMailer emails?
- How can I set up PHPMailer to use Zimbra SMTP?
- How can I use PHPMailer in Yii 1?
- How do I use PHPMailer with Yii2?
- How can I use PHPMailer with XAMPP on Windows?
- How can I use PHPMailer with React?
See more codes...