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

Create a Dictionary

You must initially create a dictionary containing the required attributes of the email. This includes the sender’s email address and all the recipients of the email.

You should first configure and verify the sender’s email address in the Catalyst console. 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.

    
copy
#Create a dictionary mail_obj = { 'from_email': 'emma@zylker.com', 'to_email': ["vanessa.hyde@zoho.com"], 'cc': ["robert.plant@zylker.com"], 'bcc': ["ham.gunn@zylker.com", "rover.jenkins@zylker.com"], 'reply_to': ["peter.d@zoho.com", "arnold.h@zoho.com"], 'subject': 'Greetings from Zylker Corp!', 'attachments': [file1], 'content': "

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

" }

Send Email

You must now pass the configured dictionary to the send_mail() method as an argument as shown in the code below. This will initiate the email sending process. The mail_service reference used below is already defined in the component instance page.

    
copy
#Send Email response = mail_service.send_mail(mail_obj)

A sample response is given below :

    
copy
{ isAsync: false, project_details: { project_name: "Onboarding", id: "2136000000007733" }, from_email: ["emma@zylker.com"], to_email: ["vanessa.hyde@zoho.com"], cc:["robert.plant@zylker.com"], bcc:["ham.gunn@zylker.com","rover.jenkins@zylker.com"], reply_to:["peter.d@zoho.com","arnold.h@zoho.com"], html_mode: true, subject: "Greetings from Zylker Corp!", content: "

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

" }

Last Updated 2023-12-18 16:20:08 +0530 +0530

ON THIS PAGE

RELATED LINKS

Send Email - API Mail