[FX.php List] Creating HTML Mail with PHPMailer
Jon Montgomery
igsmasupport at igsmasouth.org
Sat Aug 18 20:55:23 MDT 2007
Jonathan,
Maybe this will help. Look here at ob_start() and then ob_get_clean()
http://us.php.net/manual/en/function.ob-start.php
After the ob_start() all of the html and php code that needed to show in the
email. Then set a variable $custom_email = ob_get_clean(). That became the
body of my email.
Not sure if this helps.
Jon Montgomery
Illinois Grade School Music Association
On 8/18/07 6:57 PM, "Glenn Singleton" <glenn at fmutils.com> wrote:
> Jonathan,
>
> The html code that forms the email has to be declared as a PHP
> variable (I think), so the only option I can see if you want, a say,
> pure html include is to read the file into a vairable using the text
> file functions of php.
>
> Alternatively, I usually use something like :-
>
> <? include_once('html.php'); ?>
> where html.php contains
>
> $html='
> <html><head></head><body>
> <center>Title</center>
> ...
> </body></html>
> ';
>
> HTH
>
>
> Regards
> Glenn Singleton
> glenn at fmutils.com a.h.[ glenn at cornerstoneict.com.au b.h.]
> www.fmutils.com - totally free computer software and utilites for
> filemaker plus more
> focusing on the needs of special children ( contributions wanted !)
> [Mac G4 OS X 10.4.9, Mail V2.1]
>
>
>
>
> On 19/08/2007, at 9:06 AM, Jonathan Schwartz wrote:
>
>> Hi Folks,
>>
>> I'm a little stumped on what should be an easy issue.
>>
>> I am implementing the project mentioned in an earlier email...allow
>> my users to compose their own email on a php page and then send.
>>
>> I'd like to set up a pre-determined header and footer section,and
>> then insert the user compose content in the middle. I just can't
>> figure out how to successfully put the three together for phpmailer
>> to send. While I can do it easily by specifying the header and
>> footer in the same script, I am having trouble "including" the
>> HTML code from an external file. When I try and do so, I get
>> "1UserContent1", where php is placing a "1" before and after the
>> UserContent instead of the intended HTML code from the external files.
>>
>>
>> It looks like a boolean response, but I'n not sure to what.
>>
>> I *could* just store the header and footer in the phpmail script
>> and avoid the issue, but I really wanted the flexibility to mix and
>> match headers and footers.
>>
>> What am I doing wrong?
>>
>> Jonathan
>>
>>
>> --
>> Jonathan Schwartz
>> Exit 445 Group
>> jonathan at exit445.com
>> http://www.exit445.com
>> 415-381-1852
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
More information about the FX.php_List
mailing list