Jump to content

PHPMailer Help


spires

Recommended Posts

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 :)

Link to comment
https://forums.phpfreaks.com/topic/258526-phpmailer-help/
Share on other sites

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 :)

Link to comment
https://forums.phpfreaks.com/topic/258526-phpmailer-help/#findComment-1325202
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.