How can I stop sending email if the data of a field in one of the records it's different.
email proocedure like the example:
server tab:
$body = "";
while( $data = $button->getNextSelectedRecord() )
{
$body .= "OrderID: " . $data['OrderID'] . "\n";
$body .= "Customer: " . $data['CustomerID'] . "\n";
$body .= "Employee: " . $data['EmployeeID'] . "\n-----------\n\n";
}
// send the email
$email = "test@test.com";
$subject = "Sample subject";
$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:
";
$errmsg.= "File: " . $arr["errors"][0]["file"] . "
";
$errmsg.= "Line: " . $arr["errors"][0]["line"] . "
";
$errmsg.= "Description: " . $arr["errors"][0]["description"] . "
";
$result["txt"] = $errmsg;
}
if the data are like this I want to stop and get an error becouse the customer is different
Sample email message:
OrderID: 10249
Customer: TRADH
Employee: 6
-------------------
OrderID: 10251
Customer: TRADH
Employee: 3
-------------------
OrderID: 10253
Customer: HANAR
Employee: 3
-------------------
OrderID: 10251
Customer: TRADH
Employee: 3
If the selected data is like this and customer always the same it's ok and send email
Sample email message:
OrderID: 10249
Customer: TRADH
Employee: 6
-------------------
OrderID: 10251
Customer: TRADH
Employee: 3
-------------------
OrderID: 10251
Customer: TRADH
Employee: 3
Thank you