coltrane Posted September 2, 2009 Share Posted September 2, 2009 I have the following code for an email campaign: $Subject = $_POST['subject']; $content = $_POST['content']; while ($row = mysql_fetch_array ($result)){ $first_name=$row['first_name']; $last_name=$row['last_name']; $Emailto = $row['email']; $msg = "Dear $first_name $last_name, \n $content"; mail ($Emailto, $subject, $msg,$header ); How do I get $content to load up a predesigned page of pix and info? Thanks Link to comment https://forums.phpfreaks.com/topic/172873-email-content/ Share on other sites More sharing options...
ignace Posted September 2, 2009 Share Posted September 2, 2009 $subject = $_POST['subject']; $content = $_POST['content']; $template = $_POST['template']; while ($row = mysql_fetch_array ($result)){ $first_name=$row['first_name']; $last_name=$row['last_name']; $emailto = $row['email']; $header = "From: ..\r\nReply-To: ..\r\n"; if (!is_template($template)) {//load default $msg = "Dear $first_name $last_name,\n\n$content"; } else { $header .= "Content-Type: text/html"; $msg = load_template($template, $first_name, $last_name, $subject, $content); } if (!mail($emailto, $subject, $msg, $header)) { //mail was not send } } // verifies $template is indeed a template function is_template($template) { .. } // loads and returns the content of $template function load_template() { $args = func_get_args(); $template = array_shift($args); list($firstname, $lastname, $subject, $content) = $args; //.. } Link to comment https://forums.phpfreaks.com/topic/172873-email-content/#findComment-911129 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.