note 28357 deleted from function.ob-start by sniper
| From: | sniper@php.net | Date: | Mon, 03 Nov 2003 15:36:45 +0000 |
| Subject: | note 28357 deleted from function.ob-start by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59694@lists.php.net to get a copy of this message | ||
Note Submitter: daevid@daevid.com
----
here is a great way to have 'templates' in seperate files so that you can change them at
will without changing your engine code. perhaps you want multiple email templates based upon a
special offer code, or you want your sales guys to be able to design their web page without mucking
around in your php code:
------------ snip 'customer_email.php' --------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<CENTER>
<TABLE>
<TR><TD><B>Username</B></TD><TD><B><?=$User?></B></TD></TR>
<TR><TD><B>Password</B></TD><TD><B><?=$Password1?></B></TD></TR>
<TR><TD><B>Company
Code</B></TD><TD><B><?=$Company?></B></TD></TR>
</TABLE>
</CENTER>
</body>
</html>
------------ snip 'customer_email.php' --------------
------------ snip 'emailtest.php' --------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>EMAIL include test</title>
</head>
<body>
<?php
$User = "test user";
$Password1 = "mypass";
$Company = "mycomp";
// email us to let us know there is a new user.
$email = "daevid@daevid.com";
$subject = "email test";
$myname = "emailtest";
$myemail = "emailtest@daevid.com";
$myreplyemail = $myemail;
ob_start();
include("/www/secure.interactnetworks.com/customer_email.php");
$message = ob_get_contents();
ob_end_clean();
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$email."\r\n";
$headers .= "Reply-To: ".$myname." <".$myreplyemail.">\r\n";
$headers .= "X-Mailer: Linux Server";
mail($email, $subject, $message, $headers);
echo $message;
?>
check your email to see if this worked.
</body>
</html>
------------ snip 'emailtest.php' --------------