Send Page as PDF Attachment via Email
Requirements
Schedule an email to send a Zoho Creator page as a PDF attachment at defined time intervals using Deluge's sendMail task.
Use Case
To support customer engagement and business promotion, an organization uses the Pages feature in Zoho Creator to create a newsletter featuring customer testimonials, metrics, and product sales count. This newsletter will be shared with subscribed customers on the first day of every month via email in the form of PDF attachments.

Note: The page will be downloaded as a PDF via API and sent as an email attachment.
Steps to Follow
Create a form with the following details to add customer details.
Form | Form Link Name | Field Type | Field Name | Field Link Name |
Customer Details | Customer_Details | Name | Customer Name | Customer_Name |
Email | Email | Email |
Phone | Phone | Phone |
Address | Address | Address |
Decision box | Subscribe to monthly newsletter | Subscribe_to_monthly_newsletter |
- Create a page named Newsletter and customize it as necessary.
Note: It is not recommended to have embedded forms or reports in the page, as it restricts the the ability to download the page through the API.
- Publish the Newsletter page that you want to send as attachment.
Note: Kindly refrain from including sensitive information on this page, as it will be publicly accessible to everyone via permalink upon publishing.- Create a schedule workflow to run on the first day of every month. Select the start date and time as the first day of a month and time as per your preference, here we have set date as 01-Dec-2023 and Time as 07:00:00 Hrs. Set the frequency of the workflow to run Monthly and name it as Email Newsletter.

- Click Add New Action and select Deluge Script. Add the below script to the editor and save.

Note: Mail can be sent only to a maximum of 340 addresses at a time through
Deluge send mail task through the below code. For handling more than 340 addresses, proceed to the
next snippet.
- Utilize the below script to send mail to less than 340 email addresses.
- //Download the Creator page as PDF file using the invokeurl task.
- fileResp = invokeurl
- [
- url :"https://creatorapp.zohopublic.com/export/<adminUserName>/<appLinkName>/pdf/pageLinkName>/<encryptedKey>?isc5page=true"
- type :GET
- ];
- //Fetch the email addresses of all customers subscribed to newsletter.
- emailList = Customer_Details[Subscribe_to_monthly_newsletter = true].Email.getAll();
- //Send mail to all email address in the list, including the downloaded PDF file as an attachment.
- sendmail
- [
- from :zoho.loginuserid
- to :emailList
- subject :"Zylker Corporation Newsletter"
- message :"Greetings form Zylker Corporation, We are thrilled to share our newsletter of November 2023 with you. Have a great day"
- Attachments :file:fileResp
- ]
- Utilize the below provided code when handling email lists containing more than 340 email addresses.
- //Download the Creator page as PDF file using the invokeurl task.
- fileResp = invokeurl
- [
- url :"https://creatorapp.zohopublic.com/export/<adminUserName>/<appLinkName>/pdf/<pageLinkName>/<encryptedKey>?isc5page=true"
- type :GET
- ];
- //Fetch the email addresses of all customers subscribed to newsletter.
- emailList = Customer_Details[Subscribe_to_monthly_newsletter = true].Email.getAll();
- batchSize = 340; //To determine the number of email addresses to include in each batch of emails.
- emailBatch = List(); //Empty list to store the email addresses for each batch.
- index = 0; //Counter to keep track of the number of email addresses that have been added
- // Iterate over the list of email addresses and send email in batches.
- //If the index reaches the maximum batch size, send the email to the complete batch of 340 email addresses and reset all variables. Otherwise, add the current email address to the emailBatch and increment the index variable until the batch is complete.
- for each email in emailList
- {
- if(index >= batchSize)
- {
- sendmail
- [
- from :zoho.loginuserid
- to :emailBatch
- subject :"Zylker Corporation Newsletter"
- message :"Greetings form Zylker Corporation, We are thrilled to share our newsletter of November 2023 with you. Have a great day"
- Attachments :file:fileResp
- ]
- emailBatch = List();
- index = 0;
- }
- emailBatch.add(email);
- index = index + 1;
- }
- //If there are any remaining email addresses after the last batch, send them as final batch of emails.
- if (emailBatch.size() > 0)
- {
- sendmail
- [
- from :zoho.loginuserid
- to :emailBatch
- subject :"Zylker Corporation Newsletter"
- message :"Greetings form Zylker Corporation, We are thrilled to share our newsletter of November 2023 with you. Have a great day"
- Attachments :file:fileResp
- ]
- }
Substitute the variables in the preceding script with pertinent data, as indicated in the table provided below:
See How it Works
- Understand publishing a page
- invokeURL
- sendMail
- Understand Schedules