Zoho Auto Reply: Respond to Zoho emails based on conditions
Updated on March 24,2023
In this article, you'll learn how to respond to Zoho Mails automatically using Zoho Zeluge.
Let's take a simple example of where you want to auto-respond to emails with a specific subject line.
How would we go about achieving this task?
- Add an Incoming filter to Zohomail based on the subject line conditions
- Create mail connection
- Create action/custom function using Zoho Zeluge.
Create an Incoming Filter in Zohomail based on the subject line conditions.
The first step is to add a filter.
Filters can automate actions, such as creating a task from an email or auto-forwarding certain emails based on conditions to a specific email address.
To create an incoming filter, follow the following steps:
- Login to Zoho Mail
- Click the Settings icon.
- Go to Filters
- Open the Incoming Emails Filter tab.
- Click on New Filter.
- Let's give the filter name as the Subject line Re: Welcome.
- Select All the conditions (AND) as the condition type.
- Under the Conditions section, select Subject, then Begins with and in the value input box, enter Re: Welcome.
- In the actions section, click on Add an action and select custom function(creator). Click on the select function dropdown to add the custom function. We will do this in the next section.
- Check Do not check the filters for matching conditions.
Create mail connection
The first step is to create a mail connection with scope ZohoMail.messages.READ and ZohoMail.messages.CREATE.
- Under the DRE Connectors tab, click on create connection.
- Click on the Default Services tab and select Zoho OAuth.
- Give your connection an appropriate name.
- Toggle the use credentials of logged in user to Yes.
- Check ZohoMail.messages.CREATE and ZohoMail.messages.READ scopes.
- Click Create and Connect and give access in the op window.
Create action/custom function using Zoho Zeluge.
Next, we create a custom function to send the reply if an email meets the previously set conditions. We use Zoho Zeluge for this.
What is Zoho Zeluge?
It is Zoho's scripting language used to integrate the Zoho suite products and external applications. Just as AppScript is to Google Suite.
Follow the following steps to create the function:
- Click on the custom functions tab
- Give your function an appropriate name.
- Add the following code snippet:
info "To get the email data, use the 'mail_messageId' parameter sent from mail filter when calling the Custom Function.";
info "To get the email data, use the 'mail_messageId' parameter sent from mail filter when calling the Custom Function.";
/*1. Create a mail connection with scope ZohoMail.messages.READ
2. Replace "mailconnectionname" to the name of your connection.*/
messageDetails = zoho.mail.getMessage(mail_messageId, "mailconnectionname");
// mailContent = messageDetails.get("CONTENT");
// mailSubject = messageDetails.get("SUBJECT");
fromAddress = messageDetails.get("FROM");
// replace from_email with your email address.
sendmail
[
from: "from_email"
to:fromAddress
subject: "Re: Welcome to the Real Gluttons Club."
message: "Greetings, fellow foodies!
Welcome to the 'We Are the Real Gluttons' newsletter! We're thrilled ..." ]
Next, Save the function; then, in the previous window, select it as the custom function.
That's it! Our auto responder is ready to be tested.
Let's go ahead and test if the integration is working as expected.
From another account, draft an email whose subject line begins with Re: Welcome and send it to your Zoho mail as shown below:
You should immediately get a response similar to the image below:
Ready to automate your Zoho Suites workflow? Let me help you save time and work smarter! Book a call with me today for expert assistance with creating similar automation manually or using popular automation tools like Zapier and Make.