Send Page as PDF Attachment via Email

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

  1. 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

  2. Create a page named Newsletter and customize it as necessary.
  3. 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.

  4. Publish the Newsletter page that you want to send as attachment.
  5. Note: Kindly refrain from including sensitive information on this page, as it will be publicly accessible to everyone via permalink upon publishing.
  6. 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.

  7. 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.
  1. Utilize the below script to send mail to less than 340 email addresses.
  1. //Download the Creator page as PDF file using the invokeurl task.
  2. fileResp = invokeurl
  3.   [
  4.    url :"https://creatorapp.zohopublic.com/export/<adminUserName>/<appLinkName>/pdf/pageLinkName>/<encryptedKey>?isc5page=true"
  5.    type :GET
  6.   ];
  7. //Fetch the email addresses of all customers subscribed to newsletter.
  8. emailList = Customer_Details[Subscribe_to_monthly_newsletter = true].Email.getAll();
  9. //Send mail to all email address in the list, including the downloaded PDF file as an attachment.
  10. sendmail
  11.   [
  12.    from :zoho.loginuserid
  13.    to :emailList
  14.    subject :"Zylker Corporation Newsletter"
  15.    message :"Greetings form Zylker Corporation, We are thrilled to share our newsletter of November 2023 with you. Have a great day"
  16.    Attachments :file:fileResp
  17.   ] 

.

  1. Utilize the below provided code when handling email lists containing more than 340 email addresses.
  1. //Download the Creator page as PDF file using the invokeurl task.
  2. fileResp = invokeurl
  3.   [
  4.    url :"https://creatorapp.zohopublic.com/export/<adminUserName>/<appLinkName>/pdf/<pageLinkName>/<encryptedKey>?isc5page=true"
  5.    type :GET
  6.   ];
  7. //Fetch the email addresses of all customers subscribed to newsletter.
  8.  emailList = Customer_Details[Subscribe_to_monthly_newsletter = true].Email.getAll();
  9.  batchSize = 340;   //To determine the number of email addresses to include in each batch of emails.
  10.  emailBatch = List();   //Empty list to store the email addresses for each batch. 
  11.  index = 0;    //Counter to keep track of the number of email addresses that have been added

  12. // Iterate over the list of email addresses and send email in batches. 
  13. //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. 

  14.  for each  email in emailList
  15.  {
  16.   if(index >= batchSize)
  17.   {
  18.   sendmail
  19.   [
  20.    from :zoho.loginuserid
  21.    to :emailBatch
  22.    subject :"Zylker Corporation Newsletter"
  23.    message :"Greetings form Zylker Corporation, We are thrilled to share our newsletter of November 2023 with you. Have a great day"
  24.    Attachments :file:fileResp
  25.   ] 
  26.    emailBatch = List();
  27.    index = 0;
  28.   }
  29.   emailBatch.add(email);
  30.   index = index + 1;
  31.  }
  32. //If there are any remaining email addresses after the last batch, send them as final batch of emails.
  33.  if (emailBatch.size() > 0)
  34.  {
  35.   sendmail
  36.   [
  37.    from :zoho.loginuserid
  38.    to :emailBatch
  39.    subject :"Zylker Corporation Newsletter"
  40.    message :"Greetings form Zylker Corporation, We are thrilled to share our newsletter of November 2023 with you. Have a great day"
  41.    Attachments :file:fileResp
  42.   ]
  43.   }
Substitute the variables in the preceding script with pertinent data, as indicated in the table provided below:

<adminUserName>

is the username of the person who owns the application.

<appLinkName>

is the link name of the application.

<pageLinkName>

is the link name of the page that needs to be downloaded via API.

<encryptedKey>

is the unique key that is generated while publishing the page. It can be located within the URL of the published page. For example, in the following publish URL: https://creatorapp.zohopublic.com/zylker/customer-relationship-manager/page-perma/dashboard/HPtR6ZeWSEJW4TwCS2rJOCCg2k1QJZAmrngnbhVECqCWtER8FmDzEdspDwMySSsAMR9gd6PW79jNwa3gp4kjvfez9UJCp4SrmBfU

the encrypted key is as follows: HPtR6ZeWSEJW4TwCS2rJOCCg2k1QJZAmrngnbhVECqCWtER8FmDzEdspDwMySSsAMR9gd6PW79jNwa3gp4kjvfez9UJCp4SrmBfU

 

See How it Works


  1. Understand publishing a page
  2. invokeURL
  3. sendMail
  4. Understand Schedules

    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now


            Zoho Sign now offers specialized one-on-one training for both administrators and developers.

            BOOK A SESSION








                                    You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                        Manage your brands on social media

                                          Zoho Desk Resources

                                          • Desk Community Learning Series


                                          • Digest


                                          • Functions


                                          • Meetups


                                          • Kbase


                                          • Resources


                                          • Glossary


                                          • Desk Marketplace


                                          • MVP Corner


                                          • Word of the Day


                                            Zoho Marketing Automation

                                              Zoho Sheet Resources

                                               

                                                  Zoho Forms Resources


                                                    Secure your business
                                                    communication with Zoho Mail


                                                    Mail on the move with
                                                    Zoho Mail mobile application

                                                      Stay on top of your schedule
                                                      at all times


                                                      Carry your calendar with you
                                                      Anytime, anywhere




                                                            Zoho Sign Resources

                                                              Sign, Paperless!

                                                              Sign and send business documents on the go!

                                                              Get Started Now




                                                                      Zoho TeamInbox Resources



                                                                              Zoho DataPrep Resources



                                                                                Zoho DataPrep Demo

                                                                                Get a personalized demo or POC

                                                                                REGISTER NOW


                                                                                  Design. Discuss. Deliver.

                                                                                  Create visually engaging stories with Zoho Show.

                                                                                  Get Started Now









                                                                                                      • Related Articles

                                                                                                      • Automatically create daily reports and send current day's reports as email attachment

                                                                                                        Requirement Schedule custom actions to automatically create labour reports everyday at the specified time and send a filtered report of all the reports corresponding to the current day as an email attachment. Use case Let's assume your company has ...
                                                                                                      • Configure send email action

                                                                                                        To improve email deliverability, we will be following Gmail's updated sender email policy starting from February 1, 2024. This means that Gmail addresses cannot be used as a sender address in the send mail tasks. Learn More To configure an email ...
                                                                                                      • Send email notification

                                                                                                        Enable sending email notification on form submission Refer to this page to learn about sending an email on form submission Refer to this section to learn how to verify email addresses Open the form builder. Click the Properties icon in the top-right ...
                                                                                                      • Schedule a monthly email with report as pdf

                                                                                                        Requirement Schedule a monthly sales report to the sales manger in a PDF with stats on achieved sales versus target for the month. Use Case A sales management app records sales activities and numbers to track the performance of its sales team and the ...
                                                                                                      • Insert records through email

                                                                                                        Requirement When an email is received, content from the email is extracted and used to create records. Use Case The HR team sends an email to shortlisted candidates. Candidates can reply to the email with details that are extracted and added as ...
                                                                                                        Wherever you are is as good as
                                                                                                        your workplace

                                                                                                          Resources

                                                                                                          Videos

                                                                                                          Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                          eBooks

                                                                                                          Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                          Webinars

                                                                                                          Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                          CRM Tips

                                                                                                          Make the most of Zoho CRM with these useful tips.



                                                                                                            Zoho Show Resources