tags:

views:

32

answers:

1

Hi,

I have this code/text below is sent when a user reset the password of an account:

E-mail: <?php echo $sfGuardUser->getEmailAddress(); ?>
Contraseña: <?php echo $password; ?>

The problem:

in the received email this is showed:

http://img689.imageshack.us/img689/357/48099429.jpg

I have tried this:

E-mail: <?php echo $sfGuardUser->getEmailAddress(); ?><br />
Contraseña: <?php echo $password; ?>

But this below is showed in the received e-mail:

http://img820.imageshack.us/img820/1658/93491334.jpg

Any help?

Regards

Javi

+2  A: 

EMail is text, not HTML

E-mail: <?php echo $sfGuardUser->getEmailAddress().PHP_EOL; ?> 
Contraseña: <?php echo $password; ?>

or

E-mail: <?php echo $sfGuardUser->getEmailAddress()."\n\r"; ?> 
Contraseña: <?php echo $password; ?>
Mark Baker
Email is text, not HTML. Unless it is HTML... ;-) (Yes, in this case it seems not to be but it is worth noting that email can be HTML at times.
Chris
@Chris - Well you do have to send the appropriate MIME headers for an HTML mailing, which seemed a more complex solution to offer for a very a simple problem
Mark Baker
Oh, I quite agree that your solution is the best one. I was more observing that the opening statement seems to be talking generally rather than this specific case. Even if it isn't needed now it is worth noting that it is possible to do HTML e-mail since it might be useful for future problems.
Chris
Thanks Mark, but why "\n\r"?. For a new line "\n" is enough. "\n\r" outputs a blank line between the two lines.
@user248959 - Purely for the sake of windows... PHP_EOL is the cleaner option, and will be whatever is appropriate for your flavour of server, be it "\n", "\n\r" or "\r\n"
Mark Baker