I have a form I've created, and on completion they are asked to select person they want it emailed too from a drop down list.
My issue is how do I add that variable to the $mailer.
right now it is written like this
$mailer -> AddAddress('[email protected]','First Last');
how do i get my variable in there
$mailer -> AddAddress($emailAddress) - Doesn't work.
I've also tried
"'"$emailAddress"'"
- this gives me - Invalid address: '[email protected]' which is frustrating since that's the format it is looking for.
Thanks, let me know
here is the full code that I am using to call the emails
$mail->Host = "mail.yourdomain.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "mail.yourdomain.com"; // sets the SMTP server
$mail->Port = 26; // set the SMTP port for the GMAIL server
$mail->Username = "yourname@yourdomain"; // SMTP account username
$mail->Password = "yourpassword"; // SMTP account password
$mail->AddReplyTo('[email protected]', 'First Last');
$mail->AddAddress('[email protected]', 'John Doe');
$mail->SetFrom('[email protected]', 'First Last');
$mail->AddReplyTo('[email protected]', 'First Last');
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
$mail->MsgHTML(file_get_contents('contents.html'));
$mail->AddAttachment('images/phpmailer.gif'); // attachment
$mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
$mail->Send();