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)
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.
Ensure the following packages are imported:
copyimport java.io.File; import com.zc.component.mail.ZCMail; import com.zc.component.mail.ZCMailContent;
copyZCMailContent mailContent = ZCMailContent.getInstance(); //Get a ZCMailContent instance ArrayList toMailList = new ArrayList(); //Add the recipient email addresses as an array list toMailList.add("vanessa.hyde@zoho.com"); toMailList.add("r.owens@zoho.com"); toMailList.add("chang.lee@zoho.com"); ArrayList ccMailList = new ArrayList<>(); //Add the email addresses to CC as an array list ccMailList.add("p.boyle@zylker.com"); ccMailList.add("robert.plant@zylker.com"); ArrayList bccMailList = new ArrayList<>(); //Add the email addresses to BCC as an array list bccMailList.add("ham.gunn@zylker.com"); bccMailList.add("rover.jenkins@zylker.com"); ArrayList replytoMailList = new ArrayList<>(); //Add the email addresses to reply to as an array list replytoMailList.add("peter.d@zoho.com"); replytoMailList.add("arnold.h@zoho.com"); 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("p.boyle@zylker.com"); //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
Yes
No
Send your feedback to us