Stuartc1,
Thanks again for your help. Here's where I'm at. I'm getting a response from the script that the mail has been sent. However, nothing actually gets sent. So, obviously the syntax is legal enough to return the "print" statement. But, for some reason, the script is not executing as desired. Can you double check the script below to see if there an error in syntax? Otherwise, the method seems to be exactly what is needed in this situation. I can't, for the life of me, figure out why it's not actually sending the emails.
I truly appreciate everyone's assistance. We're almost there!!! 🙂
Jeremy
<?php
// create the arrays (email, name)
$email = array();
$name = array();
//find out if the form fields (email, name) have values
if(isset($emailFriend1)) {
$name[0] = $nameFriend1;
$email[0] = $emailFriend1;
}
if(isset($emailFriend2)) {
$name[1] = $nameFriend2;
$email[1] = $emailFriend2;
}
// find out the number in the array
$arr_num = count($email);
// loop that amount
for ($i=0; $i<=$arr_num; $i++) {
$to = '"$name[$i]"<$email[$i]>';
$ToSubject = "Did this work?";
$EmailBody = "Message from Refer Friends Form\n\nName: $txtName\nEmail: $txtEmail\nURL: $txtURL\nComments:\n$txtComments";
$EmailFooter = "\n\nMessage Complete";
$Message = $EmailBody.$EmailFooter;
mail($to, $ToSubject, $Message, "From: $txtEmail");
}
Print "_root.form.txtStatus=Complete - Your mail has been sent!";
?>