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

    Access your files securely from anywhere

      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 ...
                                                                                                              • Send Record Template as an Attachment in Mail

                                                                                                                Requirement Send a record summary as a PDF attachment via mail using the Deluge's send mail task. Use Case Consider an organization using Zoho Creator to manage POS operations. Whenever an invoice is generated, the invoice record template is promptly ...
                                                                                                              • Configure send email action

                                                                                                                To improve email deliverability, we will be following an updated email handling policy, effective from September 19, 2024. This means that any public and unauthenticated custom domain email addresses cannot be used as sender addresses in send mail ...
                                                                                                              • 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 ...
                                                                                                              • Send Promotion Template Messages via WhatsApp with Zoho Creator

                                                                                                                1. Requirement Increase customer engagement and sales efficiency by sending promotions and advertisements directly to customers via WhatsApp by integrating Zoho Creator with WhatsApp Business Platform. 2. Use Case A sales organization uses Zoho ...
                                                                                                                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