基本的に、このスクリプトは10分ごとに実行するように指示されますが、ロンドン時間の午後9時から午前4時の時間帯にのみスクリプトを実行したいのですが、誰かがこれを手伝ってくれますか?
また、1時間に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');";