Jump to content

[SOLVED] formated emails


SirChick

Recommended Posts

How do you send emails with a formatted layout like using < br > etc

 

I have tried it, i did this but it didn't work:

 

<?php
// Send the email.
$subject = "Welcome";
$headers = 'Activation';
$message = "Thank you for registering. To activate your account, please click on this link:";
$message = $message. "www.domain.com/activate.php?x=" .mysql_insert_id(). "&y=$EmailCode";
$message = $message. ". <br>Your username is $Username <br>
Your password is $Password2 !";
mail($Email, $subject, $message, $headers);
?>

 

The email just shows the < br > as text so it looks like this:

 

<br>Your username is test <br> Your password is test !

 

Which is obviously a bit of a pain... so how is it done exactly?

Link to comment
Share on other sites

use \r\n will cause a line break.

 

<?php
// Send the email.
$subject = "Welcome";
$headers = 'Activation';
$message = "Thank you for registering. To activate your account, please click on this link:";
$message = $message. "www.domain.com/activate.php?x=" .mysql_insert_id(). "&y=$EmailCode";
$message = $message. ". \r\nYour username is $Username \r\n
Your password is $Password2 !";
mail($Email, $subject, $message, $headers);
?>

Link to comment
Share on other sites

use \r\n will cause a line break.

 

<?php
// Send the email.
$subject = "Welcome";
$headers = 'Activation';
$message = "Thank you for registering. To activate your account, please click on this link:";
$message = $message. "www.domain.com/activate.php?x=" .mysql_insert_id(). "&y=$EmailCode";
$message = $message. ". \r\nYour username is $Username \r\n
Your password is $Password2 !";
mail($Email, $subject, $message, $headers);
?>

 

Thank you and also how do you make sure that the link to the activation page will be click able because some people report it just comes out as text which they have to copy and paste?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.