+44(0)1908 545 770
YOUR EXPERT RPA PARTNER

Team up with our RPA strategy and tech specialists for maximum automation impact

Find out more
Harness the power of UiPath in your business.
WATCH NOW

Save money and spend more time on priority work.

Book consultation
READY, SET, AUTOMATE

Let's choose, design and deploy a process automation solution for your business.

Find out more
TRANSFORM YOUR BUSINESS

Let's analyse your business to discover opportunities for innovation and automation.

Find out more

Begin your business transformation journey

Book consultation
AUTOMATE EVERY FUNCTION

Automate where it matters most. Scale to solve challenges in every area

Find out more
GIVE EVERY TEAM THE TOOLS FOR SUCCESS

Equip people with user-friendly solutions that save time and make work easier

Find out more

Which business problem
can we solve first?

Book consultation
13 August 2015

Adding an SMTP server to send an email through K2 BlackPearl

K2 BlackPearl SMTP configuration

I recently suffered a few gotchas while trying to add a new SMTP server to use for our emails, and figured that it would be a good topic to write a blog about. All of the steps discussed might not be applicable to every situation, but this article should serve as a good point of reference when you get stuck.

Lets start with the basics.

K2 Automated Testing Software

BenchQA allows full test automation of K2, including fully automated K2 SmartForms and K2 Workflow testing. It promotes test driven development for K2 and ensures continued quality assurance for K2 solutions. Easily apply changes to test cases to accommodate changes to K2 apps and ensure all apps are regression tested to avoid defects and assure continuous quality.

 

Free K2 Five Upgrade Review

We create a new workflow, and add a mail event to it. We then follow the configuration wizard, as outlined in the blog article located at here, and Bob is your uncle. But what if you want Steve as an uncle, and not Bob? What I mean is that your emails should now send succesfully, if the default setup was correct, but what if it wasn’t. Lets discuss the steps required to add a new SMTP server and send your emails through that server. For this blog post we will use gmail as our SMTP server. I have created a simple workflow with an email event already, which is pictured below.

k2 blackpearl smtp configuration

1 K2 for Visual Studio – Email Event

To add a new SMTP server we first open the Connection String Editor, located at C:Program Files (x86)K2 blackpearlHost ServerBinConnectionStringEditor.exe. We then press the + icon, and select SMTP from the dropdown.

k2 blackpearl smtp configuration

2 K2 Connection String Editor

The Connection String Editor will now prompt us for the identity of the connection string. It is important that we add the email address we will use as the ‘from’ field for our emails here. In this case I have already created a gmail account with the following address: testsmtp4velocity@gmail.com, which we will use to send our emails from. I will therefore enter this email in the prompt.

k2 blackpearl smtp configuration

3 New SMTP Connection

The new connection string will now be added to the list on the left. We select the new connection string from the list, and then complete the parameters for this connection on the right. We then press the save button and press ‘Yes’ when prompted to save the new values to the database. The screen shot below indicates the required parameters as appropriate to the google SMTP server

4 SMTP Properties

4 SMTP Properties

Now lets return to our workflow and modify it to make use of our newly added SMTP Server. First we need to open the mail event we added earlier. When we open the mail event we will check the ‘Run this wizard in Advanced Mode’ checkbox to enable us to specify our newly added server, as indicated in the screen shot below.

5 Mail Wizard Setup

5 Mail Wizard Setup

We then press next and complete the normal fields as we usually would do. Please note that the From field here needs to be the identity for the SMTP connection we added earlier, in this case testsmtp4velocity@gmail.com. This from field will be used to locate the correct connection string from the K2 configuration when the mail is sent. For this example I will send the mail to myself, just to see whether it works. The screen shot below shows the completed form.

6 Email Settings

6 Email Settings

We now press next, which will prompt us for the Message Body, which we can complete according to our hearts desire. Pressing next again will brings us to the Attachments we wish to add. One more Next brings us to the all-important choice of which SMTP server we would like to use. Note that this setting is not available unless the wizard is run in ‘Advanced Mode’. Seeing that we will be using gmail as our smtp server we will enter the gmail smtp server details into the text box, as indicated below.

7 SMTP Settings

7 SMTP Settings

Now we can finish the wizard, and deploy our workflow.
Lets test it out to see whether it works. Lets open our K2 workspace, and open the management console. Browse to the TestEmail process we just modified, and select the instances, as indicated below. Then press the Start New button.

8 Test Process using K2 Workspace

8 Test Process using K2 Workspace

Once we press on start new it will prompt us for various parameters which we can ignore for now. Just press start. A new instance of the process will be started and displayed with a status of ‘Running’. Just wait a few seconds and refresh. Wonderful, we have just sent an email, which didn’t work, as indicated by the big red ‘Error’ status displayed to us. Lets hover over the Error to see what happened.

9 Process Outcome

9 Process Outcome

‘There is no connection string for the destination email address testsmtp4velocity@gmail.com’. That is a pity. I thought we just added it. Ok, I admit, I knew this was going to be the result, but I thought I’d keep you intrigued. Now you will have to wait for my next article to see how to fix it. You can find the answer in part 2 of this article, along with a few other tips on how to resolve some other issues when trying to send an email through a SMTP server.

Need further technical advice or support?