note 28357 added to function.ob-start

From: Date: Fri, 10 Jan 2003 14:34:23 +0000
Subject: note 28357 added to function.ob-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-41959@lists.php.net to get a copy of this message
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' -------------- -- http://www.php.net/manual/en/function.ob-start.php http://master.php.net/manage/user-notes.php?action=edit+28357 http://master.php.net/manage/user-notes.php?action=delete+28357 http://master.php.net/manage/user-notes.php?action=reject+28357

« previous php.notes (#41959) next »