Hi All,
 
Trying to create a "refer a friend" script.
 
User enters 10 names and email address of a friend to refer to a site.
 
The following code SORT of works in that it will send the email, etc..
but problem is it duplicates - sends the email out twice to the same
email address.
 
**CODE***
 
foreach($nameRefered as $referedName) {
 
            foreach($emailRefered as $referedEmail) {
 
                        if ($referedEmail != "" && $referedName != "") {
 
                                    <message body here>
 
                                    /* To send HTML mail, you can set
the Content-type header. */
                                    $headers = "Return-Path:
<$support_email>\r\n";                          
                                    $headers .= "MIME-Version: 1.0\r\n";

                                    $headers .= "Content-type:
text/html; charset=iso-8859-1\r\n";
                                    $headers .= "From: $nameReferer
<".$emailReferer.">\r\n";
 
                                    mail ($referedEmail,"Your Order on
Rinkrake.com", $message, $headers);
 
                        }
            }
}
 
Any thoughts on why I get the email twice?
 
Thanks all. Much appreciated!
 
Aaron 
 

Reply via email to