Hi,

I'm running a script that connects to my database and updates the order status and appends a tracking link but I can't figure out how to get this same script to fire off the email that would be sent if you did this manually via Orders >> Edit in Admin.

The bit of script in question is as follows:

PHP Code:
{

$string "My update text here";

$connection mysql_connect($host,$usr,$pwd);
$insert mysql_db_query($db"INSERT into zen_orders_status_history (orders_id, orders_status_id, date_added, comments) values ('$itemid', '9', '$now', '$string')"$connection);
$update mysql_db_query($db"UPDATE zen_orders set orders_status='9' where orders_id='$itemid' "$connection);
mysql_close($connection);


I trawled through many previous posts but without luck. Assume the code I need is buried somewhere in orders.php but I'm paint by numbers when it comes to code so any pointers would be greatly appreciated.

Regards,

Brent