[FX.php List] Creating HTML Mail with PHPMailer

Jonathan Schwartz jschwartz at exit445.com
Sat Aug 18 22:36:43 MDT 2007


Gary,

That was it!

The html had to assigned to a variable *inside* the external  file. 
The end results looked like this:

External file (header.php):
$externalheader= '<tag>........</tag>';

External file (footer.php):
$externalfooter= '<tag>........</tag>';


In the master script...

include_once('header.php');
include_once('footer.php');

$complete_email = $externalheader.$userInput.$externalfooter;


...or something like this.

Jonathan

At 9:57 AM +1000 8/19/07, Glenn Singleton 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


-- 
Jonathan Schwartz
Exit 445 Group
jonathan at exit445.com
http://www.exit445.com
415-381-1852


More information about the FX.php_List mailing list