Email Template Formatting
| From: | Paul Lockaby | Date: | Fri, 14 Feb 2003 01:54:49 +0000 |
| Subject: | Email Template Formatting | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-7753@lists.php.net to get a copy of this message | ||
Hi,
I hope that I can get some help on this one. My site sends out a registration email, and I am trying to use Smarty to define the layout of the email. So my email template looks something like this:
e_register.tpl
----------------------------
Hello {$username},
Welcome to {#siteName#}. Your username is {$username} and your password is {$password}. You can log in by going to {#siteURL#}login.php.
Regards,
{#siteName#} Webmaster
-----------------------------
Then I do the following in my PHP script to get the output of that template to send:
register.php
-----------------------------
$tpl->assign("username",$username);
$tpl->assign("password",$password);
$body = $tpl->fetch("email/e_register.tpl");
$tpl->clear_all_assign();
-----------------------------
And then I simply make $body be the body for the email and use phpmailer to send out the email. But! The email is coming through with spaces all missing. All the blank lines are gone and tabs are gone. Anyone got any ideas as to how to include the template in the email without losing all the formatting? I don't want to send HTML email, I like plaintext, and I have searched through the documentation and the Wiki for any existing examples.
Regards,
Paul Lockaby
--
Paul Lockaby
paul@paullockaby.com
http://www.paullockaby.com