The script checks if an order is allocated to a specific fulfilment center (in this case fulfilment id "AAA1DC7C-1740-484C-B020-E95F78678931" - use Debug to find out the Id of the fulfilment center location), the script will itterate through all order items and compile an email body to be sent to a drop shipper. Then sends the email immidiatly using SMTP details specified in the SendEmailNow command.
//first we check that the order is in a specific fulfilment center
if (order.FulfillmentLocationId != new System.Guid("AAA1DC7C-1740-484C-B020-E95F78678931")) {return;}
//variable where we will compose the order items
string CollectStockItems = "";
foreach (OrderItem i in order.OrderItems) // itterate through all order items
if (!i.IsService) // check that its not a service
{
if (i.pkStockItemId != System.Guid.Empty){ // now lets make sure it is linked item
//compose order line
CollectStockItems += i.SKU + " - " + i.ItemTitle + " x " + i.Qty.ToString() + " = " + i.Cost.ToString("N2") + " " + order.Currency + "\r\n"; //\r\n is line break
foreach(OrderItemComposite c in i.Composites){ // lets itterate through all composites as well
CollectStockItems += " " + i.SKU + " - " + i.ItemTitle + " x " + i.Qty.ToString()+ "\r\n";
}
}else{ // if an item is unlinked then use Channel SKU
CollectStockItems += i.ChannelSKU + " - " + i.ItemTitle + " x " + i.Qty.ToString() + " = " + i.Cost + " " + order.Currency + "\r\n"; //\r\n is line break
}
}
// body of the email variable
string body = "Dear Drop shipper.\r\n\r\n";
body += "Would you be so kind and send out the following items to the address below: \r\n";
body += "ADDRESS: \r\n" + order.ShippingAddress+"\r\n\r\n";
body += "ORDER ITEMS\r\n" + CollectStockItems;
linnworks.finaware.CommonData.Email.SendEmailNow("servername", 25, "login", "password", true, "from@email.com", "From Name", "to@email.com", "Fedor", "Drop ship order " + order.OrderId.ToString(), body);