Hey guys i need to add another recipient to an enquiry form a i had made yonks ago, here's what i've got $mail->SendTo('info@domain.com'); $mail->SendFrom('auto-emailer@domain.com'); Code (markup): can i just add it in like so? $mail->SendTo('info@domain.com, otheraddie@domain.com'); $mail->SendFrom('auto-emailer@domain.com'); Code (markup): thanks
Did you write the mailing class? Without seeing how the script is sending, it's impossible to say whether it would accept multiple email addresses.
Hi, no i didn't, i'm useless at php unfortunately, here's some more of the code, not knowing what the mailing class looks like i'm not sure if i've provided the right part <? require('class.EMail.php'); $mail = new EMail(true); if($_GET["submit"] == "true") { if($_POST["submit"] == "Submit Enquiry") { $var_from = $_POST["dayfrom"]."/".$_POST["monthyearfrom"]; $var_to = $_POST["dayto"]."/".$_POST["monthyearto"]; if(trim($var_from) == "/") { $var_from = ""; } if(trim($var_to) == "/") { $var_to = ""; } if(trim($_POST["singledate"]) != "") { list($p1,$p2,$p3) = explode('/',$mail->USDate($_POST["singledate"])); if(checkdate($p1,$p2,$p3) == true) { if((time() - $mail->USDate($_POST["single_date"],true)) >= 0) { $vardate1 = "true"; } } } if(trim($var_from) != "" and trim($var_to) != "") { list($p1,$p2,$p3) = explode('/',$mail->USDate($var_from)); list($p4,$p5,$p6) = explode('/',$mail->USDate($var_to)); if(checkdate($p1,$p2,$p3) == true and checkdate($p4,$p5,$p6) == true) { if (($mail->USDate($var_to,true) - $mail->USDate($var_from,true)) >= 0) { if (($mail->USDate($var_from,true) - time()) >= 0) { $vardate2 = "true"; } } } } if($vardate2 == "true") { if (($mail->USDate($var_to,true) - $mail->USDate($var_from,true)) > (14*86400)) { $vardate3 = "true"; } } if($vardate1 == "true" || $vardate2 == "true") { if($vardate3 != "true") { $mail->SendTo('info@domain.com'); $mail->SendFrom('auto-emailer@domain.com'); $mail->SetSubject('Short Term Hire - Enquiry'); $array = $_POST; $array["var_to"] = $var_to; $array["var_from"] = $var_from; $array["vardate1"] = $vardate1; $array["vardate2"] = $vardate2; $array["vardate3"] = $vardate3; $mail->MsgFromTemplate('short_temp.php',$array); $mail->Send(); header("Location: form-confirmation.html"); Code (markup): thanks
Can you post the contents of require('class.EMail.php'). That's the script that does all of the work. Make sure to remove any usernames or passwords if your server uses SMTP to email.
ok found it, was on the server not my pc <? class EMail { var $to = array(); var $cc = array(); var $bcc = array(); var $from = ''; var $subject = ''; var $headers = array(); var $message = ''; var $html_email = false; function EMail($html_email = false) { $this->html_email = $html_email; } function USDate($uk_date,$ret_as_timestamp = false) { list($d,$m,$y) = explode('/',$uk_date); //die(var_dump(mktime(0,0,0,$m,$d,$y))); $ret = ($ret_as_timestamp) ? mktime(0,0,0,$m,$d,$y):$m.'/'.$d.'/'.$y; return $ret; } function LongDate($uk_date) { $stamp = $this->USDate($uk_date,true); return date('l, F d, Y',$stamp); } function MsgFromTemplate($template,$input_array = array()) { extract($input_array); ob_start(); include($template); $msg = ob_get_contents(); ob_end_clean(); $this->message = $msg; } function SendTo($email,$label = '') { $this->to[] = array('label' => $label,'email' => $email); return true; } function CCTo($email,$label = '') { $this->cc[] = array('label' => $label,'email' => $email); return true; } function BCCTo($email,$label = '') { $this->bcc[] = array('label' => $label,'email' => $email); return true; } function SendFrom($email,$label = '') { $this->from = array('label' => $label,'email' => $email); return true; } function SetSubject($subject) { $this->subject = $subject; } function AddHeader($header) { $this->headers[] = $header; } function SetMessage($message) { $this->message = $message; } function AppendMessage($str) { $this->message .= $str; } function Send() { $to_count = count($this->to); $cc_count = count($this->cc); $bcc_count = count($this->bcc); if($this->html_email) { $this->AddHeader('MIME-Version: 1.0'); $this->AddHeader('Content-type: text/html; charset=iso-8859-1'); } for($x = 0;$x < $to_count;$x++) { $label = $this->to[$x]["label"]; $email = $this->to[$x]["email"]; $str = ($label != '') ? $label.' <'.$email.'>' : $email; $this->AddHeader("To: ".$str); } for($x = 0;$x < $cc_count;$x++) { $label = $this->cc[$x]["label"]; $email = $this->cc[$x]["email"]; $str = ($label != '') ? $label.' <'.$email.'>' : $email; $this->AddHeader("CC: ".$str); } for($x = 0;$x < $bcc_count;$x++) { $label = $this->bcc[$x]["label"]; $email = $this->bcc[$x]["email"]; $str = ($label != '') ? $label.' <'.$email.'>' : $email; $this->AddHeader("BCC: ".$str); } $str = ($this->from["label"] != '') ? $this->from["label"].' <'.$this->from["email"].'>' : $this->from["email"]; $this->AddHeader("FROM: ".$str); return mail('',$this->subject,$this->message,implode("\r\n",$this->headers)); } } ?> Code (markup):
Ok this should work, from the code you had posted above: $mail->SendTo('info@domain.com'); $mail->SendTo('otheraddie@domain.com'); $mail->SendFrom('auto-emailer@domain.com'); PHP: