Catalyst Mail enables you to add the email addresses of your business that will be used to send emails to the end-users from your Catalyst application. You can configure email addresses of public domains or of your organization’s own domains. You can also use an external email client of your choice and configure its SMTP settings with Catalyst, instead of using the built-in Catalyst email client.

Send Mail

You must configure the domains, email addresses, and the SMTP settings for an email client of your choice from the console. The code snippet shown here enables you to send emails to the email addresses you specify from your Catalyst application.

Catalyst enables you to set multiple email addresses as the receivers, and to CC, BCC, and reply to through a single send mail operation. You can also attach files in your email. The maximum supported limits for email recipients and file attachments in a single send mail operation are specified below:

  • To address: 10
  • CC: 10
  • BCC: 5
  • Reply to: 5
  • Number of file attachments: 5
  • Size of file attachments: 15 MB (through a single file or multiple files upto 5 files)
Note: The subject, sender, and atleast one recipient email addresses are mandatory. Other attributes of the email are optional.

You must fetch an instance of ZCMailContent as shown in the code below. You can define the recipients and file attachments of an email as array lists. You must then set these lists, as well as the sender’s email address, the subject and the content of the email in the ZCMailContent object, and pass it as an argument to the sendMail() method to send the email.

Note: You must have configured and verified the sender’s email address in the Catalyst console to be able to send emails. If the sender's email is hosted on a private domain or if you choose to use a third-party email client, you must configure them before sending emails as well.

Ensure the following packages are imported:

import; import com.zc.component.mail.ZCMail; import com.zc.component.mail.ZCMailContent;
ZCMailContent mailContent = ZCMailContent.getInstance(); //Get a ZCMailContent instance ArrayList toMailList = new ArrayList(); //Add the recipient email addresses as an array list toMailList.add(""); toMailList.add(""); toMailList.add(""); ArrayList ccMailList = new ArrayList<>(); //Add the email addresses to CC as an array list ccMailList.add(""); ccMailList.add(""); ArrayList bccMailList = new ArrayList<>(); //Add the email addresses to BCC as an array list bccMailList.add(""); bccMailList.add(""); ArrayList replytoMailList = new ArrayList<>(); //Add the email addresses to reply to as an array list replytoMailList.add(""); replytoMailList.add(""); ArrayList attachments = new ArrayList<>(); //Add the email attachments as an array list File file1 = new File("kycform.pdf"); File file2 = new File("info.png"); attachments.add(file1); attachments.add(file2); // Set the email properties in the ZCMailContent object mailContent.setFromEmail(""); //Set the sender's email address mailContent.setToEmailList(toMailList); //Pass the recipient array list mailContent.setCcEmailList(ccMailList); //Pass the CC array list mailContent.setBccEmailList(bccMailList); //Pass the BCC array list mailContent.setReplyTo(replytoMailList); //Pass the reply to array list mailContent.setSubject("Greetings from Zylker Corp!"); //Set the email's subject mailContent.setContent("Hello,We're glad to welcome you at Zylker Corp. To begin your journey with us, please download the attached KYC form and fill in your details. You can send us the completed form to this same email address.We cannot wait to get started!Cheers!Team Zylker"); //Set the email's body as an HTML content mailContent.setAttachments(attachments); //Pass the email attachments array list ZCMail.getInstance().sendMail(mailContent); //Send emails using the mailContent object

Last Updated 2023-09-03 01:06:41 +0530 +0530