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('spires1@mail.com', 'BM', 'BM', 'spires1@mail.com', $body_content, $subject);

 

 

 

Any ideas where i'm going wrong ?

 

Thanks :)

Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.