Попов Всеволод
here is a couple of my scripts using SendEmail to show you what is possible
Order acknowledgement
if not 'Email+' then
alert("No valid contact in email field")
else
if AckFlag = 1 then
alert("Confirmation already sent!")
else
let myPdf := printAndSaveRecord(this, "OrderConf");
let myName := "Order Confirmation.pdf";
let thisBody := first((select SystemFile).OrderConfirmationLetter);
let myEmail := userEmail();
thisBody := replace(thisBody, "{Ord Company}", text('Ordered By'));
thisBody := replace(thisBody, "{Job Bag}", text('Job Bag'));
thisBody := replace(thisBody, "{Order Date}", text('Order Date'));
thisBody := replace(thisBody, "{Order Name}", 'Order Name');
thisBody := replace(thisBody, "{Order Ref}", 'Order Ref');
thisBody := replace(thisBody, "{Qty}", text(Qty));
thisBody := replace(thisBody, "{Desc}", Desc);
thisBody := replace(thisBody, "{Total Sell}", text('Total Sell'));
thisBody := replace(thisBody, "{Comment}", text('Order Confirmation Comment'));
thisBody := replace(thisBody, "{Del Company}", text('Delivery To'));
thisBody := replace(thisBody, "{Del Address}", text('Delivery Address'));
OrderConfirmation := importFile(this, myPdf, myName);
AckFlag := 1;
sendEmail({
from: myEmail,
to: 'Email+',
subject: "Order Acknowledgement from test company",
text: "Order Confirmation",
html: thisBody
});
alert("Order Confirmation Email has been Sent")
end
end
and another that picks up an attachment
Goods Dispatched
if DispFlag = 1 then
alert("Dispatched Confirmation already sent!")
else
let thisBody := first((select SystemFile).OrderDispatchedLetter);
let myEmail := userEmail();
let myAtt := first(files(record(SystemFile,1)));
thisBody := replace(thisBody, "{Ord Company}", text('Ordered By'));
thisBody := replace(thisBody, "{Order Name}", text('Order Name'));
thisBody := replace(thisBody, "{Job Bag}", text('Job Bag'));
thisBody := replace(thisBody, "{Order Date}", text('Order Date'));
DispFlag := 1;
sendEmail({
from: myEmail,
to: 'Email+',
subject: "Your order has been dispatched by Test Company",
text: "Goods Dispatched Confirmation",
html: thisBody,
attachments: myAtt
});
alert("Goods Dispatched Email has been Sent");
DisplayMenu := 1
end
end
end