Reputation: 4564
this is a sample email:
Hello $name
thank you for joining $sitenamee
regards, the management.
its saved from a textarea using a simple submit
button
the issue I am having is when I email it using the php mail() function
I get this to my email :
Hello $name
thank you for joining $sitenamee
regards, the management.
same content which is good, but the return breaks are gone.Now IF I add <br>
tags to the <textarea>
and save, it sends the email with breaks.
what would be the best way to resolve this without having to add <br>
tags to my emails?
Upvotes: 0
Views: 130
Reputation: 2215
Use the nl2br() command to have php add the
tags at runtime as you send.
http://php.net/manual/en/function.nl2br.php
nl2br($message);
mail($to, $subject, $message);
Upvotes: 2