...

View Full Version : PHP Mailer (doesnt recognise $email)



PRodgers4284
02-28-2008, 08:21 PM
I have managed to get phpmailer working and its sends email fine, but i am trying to use $email for the add address. The $email is the email field in a registration form i am using and i want the email to recognize the address that a user enter at registration, the email is then sent to the address the user has entered. Can anyone help?

I am using the following code:


require_once('class.phpgmailer.php');
$mail = new PHPGMailer();
$mail->FromName = '********';
$mail->AddAddress($email);
$mail->Subject = 'This is a test email;
$mail->Body = 'This is a test email';
$mail->Send();

angst
02-28-2008, 08:30 PM
try echoing out $email, and make sure that the value is getting that far.

like:

echo $email;
exit;

PRodgers4284
02-28-2008, 09:07 PM
try echoing out $email, and make sure that the value is getting that far.

like:

echo $email;
exit;

Hey angst i got it working, just needed to include the following 2 lines in the mail script:



$mail->IsSMTP(); // send via SMTP
$mail->Host = 'ssl://smtp.gmail.com'; // SMTP servers


Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum