Introduction:
Email, short for electronic mail, is a method of exchanging digital messages between people using electronic devices such as computers, smartphones, and tablets.
It has become one of the most widely used forms of communication in both personal and professional settings due to its convenience,speed, and accessibility.
List of Operations:
Send Email: This operation is used to send an email message.
List Emails: This operation lists emails in a specified folder on the email server.
Move Email: This operation moves an email from one folder to another on the email server.
Delete Email: This operation deletes an email from a specified folder on the email server.
Mark Email as Read: These operations mark an email as read or unread on the email server.
Count: These operation is used to count the messages in specific folder.
OnNewEmail: Receives all the emails for the specific folder.
Protocols:
POP3 (Post Office Protocol)
POP3 downloads emails from a server to a single computer, making those emails only accessible on that specific computer
IMAP (Internet Message Access Protocol)
IMAP stores emails on a server and then syncs them across multiple devices. IMAP is more advanced than POP3 and allows you to
access your email from anywhere, and on any device.
SMTP (Simple Mail Transfer Protocol)
An SMTP server is a computer or an app that is responsible for sending emails
Connector Configuration:
The Details Needs for the Email Connector Configuration are,
- Host
- Port
- Username
- Password
Generate the APP Password
Step 1: Go to your Gmail account settings click the security and 2-step verification
after enabling 2-step verification generate an App Password
Step 2: Open your Gmail account and click Settings Now navigate to forwarding to POP/IMAP option to enable it.
SMTP Configuration:
host = smtp.gmail.com
Port = 587
user = your Gmail Id
password = Gmail account App Password
Go to the Advanced tab select inline from the properties field and click on the plus icon. now display the key and value for you to enter the key and value
Key: mail.smtp.starttls.enable
Value: true
IMAP Configuration:
host = IMAP.gmail.com
Port = 993
user = your Gmail Id
password = Gmail account App Password
and tick the Insecure checkbox.
POP3 Configuration:
host = POP.gmail.com
Port = 993
user = your Gmail Id
password = Gmail account App Password
and tick the Insecure checkbox.
Connector Properties:
1. Send Connector
The Send operation sends the email. The SMTPS connection type enables SSL or TLS encryption and sends encrypted messages over the secured version of the SMTP server.
a. From Address – It is From Address.
b. To Addresses – The recipient addresses.
c. Cc Addresses – The recipient addresses of “CC”.
d. Bcc Addresses – The recipient addresses of “BCC”
e. Reply To Addresses – The email addresses to which to reply to this email.
f. Subject – The subject of the email.
g. Headers – The headers that this email carries.
h. Content – Text body of the message, which can be in any format.
i. ContentType – Content Type of the body text
j. Attachments – The attachments that are sent along with the email body
Finally Run your application and Open the Postman and trigger the URL.
check your inbox now! You should see the message.
2.On New Email IMAP
On New Email IMAP is a feature within email systems that automates actions upon the arrival of new messages via the IMAP (Internet Message Access Protocol).
- Folder – The name of the folder to poll emails from.
- Delete After Retrieve – Specifies whether to delete the returned emails after they are retrieved
- Enable Watermark – Specifies wether to apply watermark to the polled emails.
- Imap Matcher – A matcher to filter emails retrieved by this polling source. By default, already-read emails will be filtered.
- Enable Remote Search – If search filters should be resolved on the server side
- Scheduling Strategy – Configures the scheduler that triggers the polling
3. On New Email – POP3
“On New Email POP3” operates similarly to “On New Email IMAP,” both triggering actions upon the arrival of new messages.
- Folder – The name of the folder to poll emails from
- Delete After Retrieve – Specifies whether to delete the returned emails after they are retrieved
- Pop3 Matcher – A matcher to filter emails retrieved by this polling source
- Scheduling Strategy – Configures the scheduler that triggers the polling
4. List (IMAP)
Retrieve the list of emails in your mailbox, allowing you to view all emails or filter them based on available connector options.
- folderName: Specifies the folder from which you want to retrieve email messages .
- Match the matching criteria for filtering emails.
- Seen: whether to include emails that have been seen, defaulting to “INCLUDE”.
- Answered: Specifies whether to include emails that have been answered, defaulting to “INCLUDE”.
- Deleted: Specifies whether to include emails that have been deleted, defaulting to “INCLUDE”.
- Recent: Specifies whether to include recent emails, defaulting to “INCLUDE”.
- Received since: Specifies a date range for emails received since a certain date.
- Received until: Specifies a date range for emails received until a certain date.
- Sent since: Specifies a date range for emails sent since a certain date.
- Sent until: Specifies a date range for emails sent until a certain date.
- Subject regex: Allows filtering emails based on a regular expression pattern in the subject line.
- From regex: Allows filtering emails based on a regular expression pattern in the sender’s email address.
- deleteAfterRetrieve: Is whether to delete emails from the server after retrieval. It’s set to false (default) in this example.
- pageSize: Is the maximum number of emails to retrieve per page. It’s set to 1 in this example.
- paginationOffset: Is the pagination offset. It’s set to 0 in this example.
- limit: Is the maximum number of emails to retrieve. It’s set to -1 to retrieve all emails.
Now! Run your application and Open the Postman and trigger the URL.
5. List (POP3)
- folderName: in only the INBOX Folder retrieve email messages
- Match the matching criteria for filtering emails.
- receivedSince: Specifies the date and time since which emails were received.
- til: Specifies the date and time until which emails were received.
- sentSince: Specifies the date and time since which emails were sent. Similar to receivedSince.
- sentUntil: Specifies the date and time until which emails were sent. Similar to receivedUntil.
- subjectRegex: Allows filtering emails based on a regular expression pattern in the subject.
- fromRegex: Allows filtering emails based on a regular expression pattern in the sender’s email address.
- deleteAfterRetrieve: Determines whether to delete emails from the server after retrieval, set to false.
- pageSize: Is the maximum number of emails to retrieve per page, set to 10.
- paginationOffset: Is the pagination offset, set to 0.
- limit: Is the maximum number of emails to retrieve, set to -1 to retrieve all emails.
Now! Run your application and Open the Postman and trigger the URL.
6. Count Message IMAP
Specifies the mailbox folder count the number of messages in an IMAP email server
- Mailbox Folder – Mailbox folder where the emails are.
- Count Filter – Count only messages specified with this option.
Run your application and Open the Postman and trigger the URL.
7. Count-messages-POP3
Specifies the mailbox folder where you want to count the messages. In POP3, there’s typically only one folder available, and it’s usually named “INBOX”.
8. Delete
Delete the email associated with the specified email ID from the mailbox. In IMAP mailboxes, all messages marked for deletion will be permanently removed from the folder.
a. Mailbox Folder – Mailbox folder from which to delete the emails
b. Email ID – Email ID number of the email to delete
9. Move to folder
Transfer the email with the specified ID, “emailId,” from the source folder to the target folder.
sourceFolder: Specifies the source folder from which emails will be moved. In this case, it’s the INBOX.
targetFolder: Specifies the target folder to which emails will be moved. Here, it’s [Gmail]/Trash.
emailId: This attribute determines which email(s) will be moved. The payload.attributes.id suggests that the email ID is expected to be present in the payload attributes.
createTargetFolder: This parameter is set to false to indicate that the target folder should not be created if it doesn’t exist already.
Now! Run your application and Open the Postman and trigger the URL.
check your Mail now! You should see the Mail Changes.
10. Mark as Deleted
Mark an incoming email for deletion. When an email is marked for deletion, it is scheduled to be removed once the folder is closed. This action does not immediately eliminate the email from the mailbox folder, but rather changes its status. Subsequently, executing either IMAPOperations#expungeFolder(MailboxConnection, String) or IMAPOperations#delete(MailboxConnection, String, long) will permanently erase all emails marked for deletion from the mailbox. This operation is directed towards individual emails.
Mailbox Folder: Specifies the folder from which you want to delete the message.
EmailId: Specifies the ID of the email message you want to mark as deleted.
11. Mark as Read
Designate a single email as “READ,” altering its status within the specified mailbox folder. This operation focuses on individual emails, allowing for precise management of email states
sourceFolder: Specifies the folder where the email you want to mark as read is located.
EmailId: Specifies the ID of the email message you want to mark as read.
Run your application and Open the Postman and trigger the URL.
check your inbox now!