spires Posted March 8, 2012 Share Posted March 8, 2012 Hi. I'm using PHP mailer. But I can't get it to send the Email: Class: public function send_notification($sendTo, $name, $from_name, $from_email, $body_content, $subject){ $message =<<<EMAILBODY {$body_content} EMAILBODY; $message = wordwrap($message, 70); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "localhost"; $mail->Port = 25; $mail->SMTPAuth = false; $mail->isHTML(TRUE); $mail->FromName = $from_name; $mail->From = $from_email; $mail->AddAddress($sendTo, $name); $mail->Subject = $subject; $mail->Body = $message; $result = $mail->Send(); return $result; } PHP $body_content = ' Dear BusinessMobile.com <br /><br /> A website user has filled in the form on the website. See the details below. <br /><br /> Company: '.$company.'<br /> Name: '.$name.'<br /> Email: '.$email.'<br /> Tele: '.$telephone.'<br /> Message: '.$message.'<br /><br /> Interest: '.$Fpage.'<br /> Reference: '.$ref.'<br /><br />'; $subject = 'BusinessMobile.com - Contact Request'; Form_signup::send_notification('[email protected]', 'BM', 'BM', '[email protected]', $body_content, $subject); Any ideas where i'm going wrong ? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/258526-phpmailer-help/ Share on other sites More sharing options...
spires Posted March 8, 2012 Author Share Posted March 8, 2012 Hi All the Variable are getting pushed in to the function: send_notification($sendTo, $name, $from_name, $from_email, $body_content, $subject) As I can echo them out. So I'm guessing it would be in this section: public function send_notification($sendTo, $name, $from_name, $from_email, $body_content, $subject){ $mailMessage =<<<EMAILBODY {$body_content} EMAILBODY; $mailMessage = wordwrap($mailMessage, 70); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "localhost"; $mail->Port = 25; $mail->SMTPAuth = false; $mail->isHTML(TRUE); $mail->FromName = $from_name; $mail->From = $from_email; $mail->AddAddress($sendTo, $name); $mail->Subject = $subject; $mail->Body = $mailMessage; $result = $mail->Send(); return $result; } I ideas would be a great help thanks Quote Link to comment https://forums.phpfreaks.com/topic/258526-phpmailer-help/#findComment-1325202 Share on other sites More sharing options...
spires Posted March 8, 2012 Author Share Posted March 8, 2012 Plue: $send = Form_signup::send_notification('email', 'BM', 'BM', 'email', $body_content, $subject); echo $send; Returns 1 So it should be working Quote Link to comment https://forums.phpfreaks.com/topic/258526-phpmailer-help/#findComment-1325205 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.