This approach is useful for sending welcome letters, instructions, or promotional offers after order creation.
// 1. Define the variables using the submitted input
customerName = input.Customer_Name1;
orderID = input.ID;
customerEmail = input.Email_Address;
// 2. Define the HTML Content for each PDF separately
// --- HTML for PDF 1 (Welcome) ---
html1 = "<html><head><meta charset='utf-8'/>"
+ "<style> ... your CSS styles ... </style></head><body>"
+ "<div class='container'>"
+ "<h1>Confirmation & Welcome</h1>"
+ "<div>Hello <b>" + customerName + "</b>, thank you for your order.</div>"
+ "</div></body></html>";
// --- HTML for PDF 2 (Instructions) ---
html2 = "<html><head><meta charset='utf-8'/>"
+ "<style> ... CSS styles ... </style></head><body>"
+ "<h2>Next Steps & Processing</h2>"
+ "<div>Review your shipping and contact details.</div>"
+ "</body></html>";
// --- HTML for PDF 3 (Special Offer) ---
`` html3 = "<html><head><meta charset='utf-8'/>"
+ "<style> ... CSS styles ... </style></head><body>"
+ "<h3>Special Offer — Thank you!</h3>"
+ "<div>Use coupon <b>SAVE15</b> on your next order.</div>"
+ "</body></html>";
// 3. Convert each HTML string into a separate PDF file object
pdfFile1 = zoho.file.convertToPDF(html1);
pdfFile2 = zoho.file.convertToPDF(html2);
pdfFile3 = zoho.file.convertToPDF(html3);
// 4. Send email with all PDFs attached
sendmail
[
from: zoho.adminuserid
to: customerEmail
subject: "Your Order Documents - Order #" + orderID
message: "Dear " + customerName + ", please find your documents attached."
attachments: file:pdfFile1, file:pdfFile2, file:pdfFile3
];