Zippyaus Posted October 28, 2008 Share Posted October 28, 2008 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 More sharing options...
runnerjp Posted October 28, 2008 Share Posted October 28, 2008 yer try this $body .= "They have signed up for ".$Signup.""; you missed a " of the end Link to comment https://forums.phpfreaks.com/topic/130393-solved-phpmailer-sending-two-messages/#findComment-676378 Share on other sites More sharing options...
Zippyaus Posted October 29, 2008 Author Share Posted October 29, 2008 Thanks runnerjp That was an error in my post. I found that I had not put in the second <?php if(!$mail2->Send()) { echo "Mailer Error: " . $mail2->ErrorInfo; } else { echo "Message sent!"; }?> All is working. Cheers Link to comment https://forums.phpfreaks.com/topic/130393-solved-phpmailer-sending-two-messages/#findComment-677052 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.