Jump to content

[SOLVED] phpMailer - Sending two messages


Zippyaus

Recommended Posts

Hi

 

I am using PHPMailer to send me a message when a user signs up to my site.  I am trying to make it also send the user their login details but I am failing to get it to work.  Can anyone see what I am doing wrong?

 

<?php
$mail             = new PHPMailer();

$FullName         = $regData['Name'][0];
$Signup           = $regData['Signup'][0];
$EmailAddress     = $regData['Email'][0];
$Password     	  = $regData['Password'][0];
$Nickname    	  = $regData['UserID'][0];
$Company    	  = $regData['Company'][0];

$body 			  .= $FullName." of " .$Company. " has joined.<br/>";
$body 			  .= "They have signed up for ".$Signup.";
$body             = eregi_replace("[\]",'',$body);

$text_body  = "Hello, " . $FullName . " of " .$Company. " has joined.\n\n";  
$text_body .= "They have signed up for " .$Signup."\n\n";  



$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = "myhost.com"; // SMTP server

$mail->From       = "[email protected]";
$mail->FromName   = "Zippy";

$mail->Subject    =  $FullName." has joined the challenge";

$mail->AltBody    = $text_body ; // optional, comment out and test

$mail->MsgHTML($body);



$mail->AddAddress("signup@domain", "Zippy Aus");





$mail2             = new PHPMailer();


$body2 			  .= $FullName." of " .$Company. " Welcome.<br/>";
$body2 			  .= "Username is " .$NickName. "<br/>";
$body2 			  .= "Password is " .$Password. "<br/>";
$body2             = eregi_replace("[\]",'',$body2);



$mail2->IsSMTP(); // telling the class to use SMTP
$mail2->Host       = "myhost.com"; // SMTP server

$mail2->From       = "[email protected]";
$mail2->FromName   = "Zippy";

$mail2->Subject    =  $FullName."Welcome to my site";



$mail2->MsgHTML($body);


$mail2->AddAddress($regData['Email'][0] , $regData['Name'][0]); 


?>

 

The code appears to work when use one of them on the page.  But if I add in the $mail2 it fails.

 

Any help would be greatly appreciated.

 

Cheers

 

ZP

Link to comment
https://forums.phpfreaks.com/topic/130393-solved-phpmailer-sending-two-messages/
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.