I am hoping someone can give me some direction. I know I am close to solving but just can't figure it out.
I have a list page and placed a button on the top of the list. The button will send out an email to the selected records in the list.
If I only select one, everything is perfect. Email sent.
If I select two or more:
The first person will get the email.
The second person will get one email but it will contain both emails to the first person and the email to the second person.
Maybe something with the array code formatting, missing a dot or something.
Any help from someone would be greatly appreciated.
Here is my code:
$body = "";
while( $data = $button->getNextSelectedRecord() )
{
$email = $data["client_email"];
$body .= "Dealership: " . $data['customer'] . "
";
$body .= "Hardware: " . $data['inventory'] . "
";
$body .= "Serial Number: " . $data['serial_number'] . "
";
$body .= "Promised Returned Date: " . $data['promised_date'] . "
";
$body .= "Dear Client,"."
";
$body .= "Your hardware return listed above is past due."."
";
$body .= "Please contact us if there is any issue with returning this hardware."."
";
$body .= "If you have recently done so, please disregard this notice."."
";
$body .= "Please ship to:" ."
";
$body .= "ABC Solutions"."
";
$body .= "123 Main Street"."
";
$body .= "Sometown, VA 23228"."
";
$body .= "Your attention to this request is greatly appreciated."."
";
$body .= "Thanks again,"."
";
$body .= "The ABC Solutions Team"."
";
// send the email
$subject = "Friendly reminder about an Over-Due Hardware Return.";
$arr = runner_mail(array('to' => $email, 'subject' => $subject,'body' => $body));
}
$result["txt"] = "Emails were sent.";
// if error happened print a message on the web page
if( !$arr["mailed"] )
{
$errmsg = "Error happened: <br>";
$errmsg.= "File: " . $arr["errors"][0]["file"] . "<br>";
$errmsg.= "Line: " . $arr["errors"][0]["line"] . "<br>";
$errmsg.= "Description: " . $arr["errors"][0]["description"] . "<br>";
$result["txt"] = $errmsg;
}
Thanks for your help.
Paul
I have a list page and placed a button on the top of the list. The button will send out an email to the selected records in the list.
If I only select one, everything is perfect. Email sent.
If I select two or more:
The first person will get the email.
The second person will get one email but it will contain both emails to the first person and the email to the second person.
Maybe something with the array code formatting, missing a dot or something.
Any help from someone would be greatly appreciated.
Here is my code:
$body = "";
while( $data = $button->getNextSelectedRecord() )
{
$email = $data["client_email"];
$body .= "Dealership: " . $data['customer'] . "
";
$body .= "Hardware: " . $data['inventory'] . "
";
$body .= "Serial Number: " . $data['serial_number'] . "
";
$body .= "Promised Returned Date: " . $data['promised_date'] . "
";
$body .= "Dear Client,"."
";
$body .= "Your hardware return listed above is past due."."
";
$body .= "Please contact us if there is any issue with returning this hardware."."
";
$body .= "If you have recently done so, please disregard this notice."."
";
$body .= "Please ship to:" ."
";
$body .= "ABC Solutions"."
";
$body .= "123 Main Street"."
";
$body .= "Sometown, VA 23228"."
";
$body .= "Your attention to this request is greatly appreciated."."
";
$body .= "Thanks again,"."
";
$body .= "The ABC Solutions Team"."
";
// send the email
$subject = "Friendly reminder about an Over-Due Hardware Return.";
$arr = runner_mail(array('to' => $email, 'subject' => $subject,'body' => $body));
}
$result["txt"] = "Emails were sent.";
// if error happened print a message on the web page
if( !$arr["mailed"] )
{
$errmsg = "Error happened: <br>";
$errmsg.= "File: " . $arr["errors"][0]["file"] . "<br>";
$errmsg.= "Line: " . $arr["errors"][0]["line"] . "<br>";
$errmsg.= "Description: " . $arr["errors"][0]["description"] . "<br>";
$result["txt"] = $errmsg;
}
Thanks for your help.
Paul