tags:

views:

32

answers:

5
mail($email, $subject, "Welcome to **!\n\n The password for your account is:\n $password", $headers);

I want the $password to be 2 spaces forward, what should i use?   doesnt not work in hotmail at least

A: 

Add <html> and </html>: to indicate the message is HTML formatted. Then you can use &nbsp;

Use the nl2br function to convert newlines to <br/>s.

Also set the Content-Type by appending a header "Content-Type: text/html; charset=UTF-8".

If you don't want to use HTML: you can use the tab-character \t too, but not sure if Hotmail supports that eighter.

Pindatjuh
After that you'll have to convert all those `\n`'s to `<br/>`'s
Scott Anderson
A: 

This really depends on what you are reading it in. The problem with Hotmail is that it sees it as plan text, but converts it to HTML most likely to display to you.

Look at example 4 on how to send html email using php.

Chris Bartow
A: 

If the e-mail's Content-Type is text/plain, then all spaces should be honored. Sounds like you're transmitting the e-mail message as text/html, which is why you would need the &nbsp to get the second space to show up.

Andrew Noyes
A: 

You'll can send the email as HTML which requires extra headers and actual HTML in your message body:

// Add extra headers to $headers
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

// Send mail as HTML
mail($email, $subject, "<html><body>Welcome to **!<br><br> The password for your account is:<br> &nbsp;$password</body></html>", $headers);
John Conde
A: 

Use the http://swiftmailer.org/ Class to do emailing with PHP. It's nice done and gives you a lot of nice features.

DrDol