Do you know how I can edit this php file to send automatic order confirmation emails to customers?
[php]<?php
$strCodes = GSMFUSION_GetOrder($row->OrderIdFromServer, $row->APIKey, $row->AccountId, $row->ServerURL);
$responseArr = explode(’~’, $strCodes);
$code = ‘’;
if(isset($responseArr[1]))
$code = stripslashes($responseArr[1]);
$imeiNo = substr($row->product, -15);
$service = substr_replace($row->product, “”, -15);
if($responseArr[0] == ‘2’ || $responseArr[0] == ‘3’)
{
if($responseArr[0] == ‘2’)
{
$message = “Dear Customer, \n\nYour order has been successfully completed. \n\nWe would like to thank you for choosing us to unlock your phone.\n\nThe information needed to unlock your phone is provided below:\n\nService: $service\n\nIMEI #: $imeiNo\n\nUnlock Code: $code\n\n\nPlease click the link below to find the unlocking instructions for your specific phone”;
$headers = “From: [email protected]”. “\r\n” .‘Bcc: [email protected],[email protected]’ . “\r\n”;
mail($row->payer_email, ‘Your Unlock code is here!’, $message, $headers);
mail(‘[email protected]’, ‘Your Unlock code is here!’, $message, $headers);
$objDBCD14->execute(“UPDATE orders SET unlock_code = '”.check_input($code, $objDBCD14->dbh)."’, orderstatus = ‘completed’,
last_updated = ‘".date(‘Y-m-d H:i:s’)."’, hiddenstatus = ‘0’ WHERE order_id = ‘".$row->order_id."’");
}
else if($responseArr[0] == ‘3’)
{
$message = “Dear Customer, \n\nUnfortunately, the Unlock Code for your phone cannot be found under the service selected.\n\nThe details of your order can be found below:\n\nService: $service\n\nIMEI #: $imeiNo\n\nReason: $code\n\n\n\nA FULL REFUND WILL BE ISSUED TO YOUR ACCOUNT WITHIN 1 BUSINESS DAY. “;
$headers = “From: [email protected]”;
mail($row->payer_email, ‘Your Unlock Code cannot be found.’, $message, $headers);
mail(‘[email protected]’, ‘Your Unlock Code cannot be found.’, $message, $headers);
$objDBCD14->execute(“UPDATE orders SET unlock_code = '”.check_input($code, $objDBCD14->dbh).”’, orderstatus = ‘cancelled’,
last_updated = '”.date(‘Y-m-d H:i:s’)."’, hiddenstatus = ‘0’ WHERE order_id = ‘".$row->order_id."’");
}
}
?>[/php]