Forum Moderators: coopster

Message Too Old, No Replies

Problems sending 2 emails in 1 script

2 emails in 1 script, changing email address

         

mikejson

6:36 pm on Oct 1, 2003 (gmt 0)

10+ Year Member



Hi all, I'm having a problem sending 2 emails from one script. Basically I compose an email and send it to X@here.com after that, I want to send an auto-response to the user, at the email provided by the user. Now what is happening is both emails are going to the same place.

This is the code after $message was composed. recipientList was set to X@here.com, $subject was set, and the parameterList was set like the following.

// Handle the actual Email part.
//Send to this email address, delimit the email addresses by commas.
$recipientList = "X@here.com";
//This sets up the From feild
$parameterList = "From: ".$last." ".$first." <".$email.">\r\n"."Reply-To: ".$email."\r\n";
//This is the subject line containing last name, first name
$subject = $last.", ".$first.", TEST EMAIL";

... then this is what I do with it...

//Mail it out after everything is set in the message.
mail( $recipientList, $subject, $message, $parameterList );

...now the auto-reply, which emails to the recipentList from above and not the newly set one below...

//Mail the auto-reply
$recipentList = $email;
$subject = "Auto-Reply Experience Profile Submittion Successful";
$message ="Thank you for submitting your Experience Profile.";
$message .="\nWe will add this to your application when it is recieved.";
$message .="\nAny further questions please refer to our website,";
$message .="\n and the FAQs and Inquiries page.";
$message .="\n ";

//Leaving parameterList so if they reply it goes back to them.
mail( $recipientList, $subject, $message, $parameterList );

header ( "Location: success.php" );

?>

So what the heck am I doing wrong? Can you send 2 emails from one script?

Timotheos

6:49 pm on Oct 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$recipentList = $email;

typo alert!

mikejson

8:30 pm on Oct 1, 2003 (gmt 0)

10+ Year Member



ya, I saw that...

But guess what, it's still not emailing the auto reply

I fixed the typo almost immediately after posting, and I tested it, of course it's not email to the same account anymore cause the recipientList is getting changed, but it's not email anywhere.....

Thoughts?

dreamcatcher

8:47 pm on Oct 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried removing the $recipentList = $email; part of the code and just using:

//Leaving parameterList so if they reply it goes back to them.
mail( $email, $subject, $message, $parameterList );

Also make sure the variable $email has a value by echoing it somewhere on your page.

echo $email;

:)