piano0011
piano0011

Reputation: 61

the following mail does not produce line breaks with double quotes

I am using another version of the mail function and trying to get \n\n to work but it is not producing a separate line as intented.

Here is my code:

// email body content
$htmlContent = "<h1>Thank-you for purchasing your Level 1 Monthly Subscriptionplan!</h1>
    <p>Dear $name \n\nThank you for purchasing your Level 1 Monthly Subscriptionplan for $price. \n\nPlease make sure that you check your student's general information to view your details carefully and note the expiry date for your subscriptionplan.\n\nFrom,\n\nPianoCourse101</p>";

Upvotes: 0

Views: 259

Answers (2)

Jerodev
Jerodev

Reputation: 33186

In html mails, you should use <br /> to add a line break.

All html parsers will ignore \n line breaks in the code.

Upvotes: 1

tshimkus
tshimkus

Reputation: 1181

\n will create a newline break in the code, but not within an HTML paragraph. You can either place all paragraphs within their own <p></p> tags or you can force an HTML line break using <br /> where you have the \n\n\ code

Upvotes: 2

Related Questions