Linx Main Linx Help

Email Plugin Configuration

#1

Using Linx, you are able to integrate with Email applications in order to read and send emails.

The Linx Email plugin contains two functions which are ReadEmail and SendEmail respectively.

This post will detail how to setup both of these functions to integrate with your mailbox.

A demo solution has been built to show the basic functionality:
LinxEmailSolution.lsoz (10.1 KB)

Before you begin, you must have the Email Plugin installed for your solution.

SendEmail

The SendEmail function is used to send emails to an SMTP server for distribution to recipient.

If you do not have a dedicated SMTP server, you can make use of Gmail’s one provided for you if you have an account.

To begin, we are just going to add a SendMail function by dragging it from the Plugins panel onto the process pane.

image
There are a number of properties that need to be configured before we can connect to the email client:


First, we need to link it to a SMTP server, simply reference the server name, in this example I am using Gmails built in SMTP server:

Server

Smtp server: smtp.gmail.com

Credentials

Username: your mail account user name

Password: your mail account password

Note: In some cases like gmail, you will need to configure an App specific password for Linx to connect, further instructions can be found here.

Options

Enable SSL: True

Port: 25

Now that we have setup the configuration, we can send a test email.

To send a mail, at a minimum the following need to be completed:

Receivers:

To: email address that you want to send to

Senders:

From: email address you want to send as

Note: if your SMTP server is setup to be able to send as whatever you like then you can fill this in. By default, it will send with the smtp servers default settings. In the case of using a personal gmail account it will send as the accounts owner.

If you debug/run the process, you should see the process successfully complete and a mail arrive in the target mailbox.

Additional Options

There are a number of other properties that you can configure in terms of the SendEmail.

Content:

Subject: the subject line that you want to appear on the mail.

Text body: the body of the email, if using this property, the mail will be sent as plain text.

Html body: the body of the email, if using this property, the mail will be sent as HTML. Note: If both the Text and HTML fields are used, the HTML body will override whatever is in the ‘Text body’ field.

Attachments:

Add an attachment, or multiple attachments by referencing the file paths of the attachments. For multiple attachments, you will need to build up a list and then add it to this property (this is demonstrated in the demo solution).

Note: The above fields can also be references to outputs, settings and local types in the usual Linx manner, the demo example demonstrates these.

Example:

An example of the above configuration is found in the Demo solution: ‘LinxEmailSolution’, in the process ‘SendEmailDemo’. This process, retrieves names, email addresses and attachments from a database and these uses these values for sending the email.
image


image

ReadEmail

The ReadEmail function will connect to a mail server using either IMAP or POP3.

Reading Emails via Pop3

POP (Post Office Protocol) implements the offline mail access model, where mail is retrieved and then deleted from the server where the mailbox resides so it can be used on a local machine. Emails are hence transferred permanently from a central server to one client machine.
image
ReadMail Properties:

Similar to the above SendMail section, you need to configure your function to connect to your mail box. Using the same account as the example above:

Mail server settings

Server name: pop.gmail.com

User name: Username of your account

Password: Password of your account

Port: 995

Use SSL: True

Options

Delete after read: tick this if you want the email removed from your mailbox

Body as HTML: tick this if you want the email body returned as formatted HTML

Attachment Options:

  • None: will ignore attachments.
  • SaveToFile: will save the attachments as files to the specified directory. The filepath is an automatic output of this function and can be used to use an attachment later in the process.
  • ReturnData: will convert the attachment contents to a string and allow you to use that string further down in your process. This option will only work for text-based attachments, not binary ones.

Note: Both SaveToFile and ReturnData can both be selected.

Save email: set to true to save the whole email to disk

File directory: Directory where email and/or attachments will be saved to.

Email file type:

  • Eml
  • tnef

You can test this by running your process and the ReadEmail function will start to return email objects.

To enhance this process by making use of filtering please this post.

Reading Emails via IMAP

IMAP (Internet Message Access Protocol) provides access and retrieve mail functions for a remote mail server so the mails can be used locally while retaining them also on the server. IMAP sets message flags so that the user can keep track of which messages he or she has already seen, already answered, and so on.
image
ReadMail Properties:

Similar to the above SendMail section, you need to configure your function to connect to your mail box. Using the same account as the example above:

Mail server settings

Server name: imap.gmail.com

User name: Username of your account

Password: Password of your account

Port: 993

Use SSL: True

Options

Folder: This is the folder in you actual mailbox that you want to search through i.e Inbox

Only unread items: Tick this if you want to scan unopened emails

Mark as read: Tick this if you want the mails that Linx retrieves to be marked as ‘read’.

Move to folder: This is a folder in your actual mailbox that you want the retrieved email to be moved to.

Delete after read: Tick this if you want the emails retrieved by Linx to be deleted from your mail box.

Body as HTML: Set to true to retrieve the email’s body formatted as HTML.

Attachment Options:

  • None: will ignore attachments.
  • SaveToFile: will save the attachments as files to the specified directory. The filepath is an automatic output of this function and can be used to use an attachment later in the process.
  • ReturnData: will convert the attachment contents to a string and allow you to use that string further down in your process. This option will only work for text-based attachments, not binary ones.

Save email: set to true to save the whole email to disk

File directory: Directory where email and/or attachments will be saved to.

Email file type:

  • Eml
  • tnef

You can test this by running your process and the ReadEmail function will start to return email objects.

To enhance this process by making use of filtering please this post.

0 Likes

Read email error
unlisted #2
0 Likes

Email Filtering
listed #3
0 Likes