基本上这个脚本将被告知每 10 分钟运行一次,但我只希望脚本在伦敦时间晚上 9 点到凌晨 4 点运行,有人可以帮忙吗?
另外我想限制脚本每小时发送不超过 500 封电子邮件。
/*Email Client configuration. Here you will need to specify Server, user name and password for your SMTP server, and also testing tag*/
string SMTPServer = "mail.justshipit.net";
int SMTPPort = 26;
string UserName = "no-reply+justshipit.net";
string Password = "00000";
string FromEmail = "no-reply@justshipit.net";
string FromName = "Zoozio @ Amazon";
//email subject and email body
string Subject = "Please Leave feedback for your [{Source}] order from SUPER COOL STORE";
string eBayEmailBody = "Hello, [{Name}].\r\n\r\nYou recently purchased:\r\n\r\n[{ItemList}]\r\n\r\nWe hope everything was satisfactory and would really appriciate it if you could go to www.amazon.co.uk/feedback and leave us some positive feedback\r\nif you had any issues please get in contact with us ASAP as we want to sort things out.\r\n\r\nCall Us:0843 289 2766\r\n\r\nMany Thanks\r\nAdam\r\nCustomer Care Manager ";
/*query syntax. Here we will select all orders processed 14 days ago but not older than 1 month, that don't have FEEDBACK email sent
and order item table. Two queries in one request
*/
string query =@"SELECT pkOrderId,cEmailAddress, cFullName, [Source]
FROM [Order] o
LEFT OUTER JOIN Order_LifeHistory ls on ls.fkOrderId = o.pkOrderID and ls.fkOrderHistoryTypeId='EMAIL_SENT' and ls.Tag='FEEDBACK'
WHERE
o.bProcessed = 1 AND o.HoldOrCancel=0 AND o.dProcessedOn > DATEADD(D,-10,GETDATE()) AND ls.sid_history is null
AND o.Source IN ('AMAZON');
SELECT pkOrderId,ItemNumber = oi.ItemNumber,ItemTitle = sis.cItemName
FROM [Order] o
INNER JOIN [OrderItem] oi on oi.fkOrderID = o.pkOrderID
INNER JOIN [StockItems] sis on sis.pkStockID = oi.fkStockID
LEFT OUTER JOIN Order_LifeHistory ls on ls.fkOrderId = o.pkOrderID and ls.fkOrderHistoryTypeId='EMAIL_SENT' and ls.Tag='FEEDBACK'
WHERE
o.bProcessed = 1 AND o.HoldOrCancel=0 AND o.dProcessedOn > DATEADD(D,-10,GETDATE()) AND ls.sid_history is null
AND o.Source IN ('AMAZON');";
//SELECT pkOrderId,ItemNumber = oi.ItemNumber,ItemTitle = sis.cItemName
//FROM [Order] o
//INNER JOIN [OrderItem] oi on oi.fkOrderID = o.pkOrderID
//INNER JOIN [StockItems] sis on sis.pkStockID = oi.fkStockID
//LEFT OUTER JOIN Order_LifeHistory ls on ls.fkOrderId = o.pkOrderID and //ls.fkOrderHistoryTypeId='EMAIL_SENT' and ls.Tag='FEEDBACK'
//WHERE
//o.bProcessed = 1 AND o.HoldOrCancel=0 AND o.dProcessedOn > DATEADD(D,-10,GETDATE()) //AND ls.sid_history is null
//AND o.Source IN ('AMAZON');";