How to use email connector

1
Hi all!   Apologies for the potentially quite basic question but I’m having a real difficulty figuring out how to get the email connector module to work. For my use case I want to be able to send people who use my app emails. I don’t care about receiving any replies as they will just be notification emails.  I have added the Email Connector module to my project and completed all the pre-requisites mentioned in the documentation but I’m confused as to how the email sending process actually works. The “Add Email Account” wizard keeps giving me errors. I see “The string provided is not an encrypted string. Returning the plain string.” in the console and an error popup that just says “smtp” on the app itself.  I am using the Automatically detect your email server settings option, and I am trying to connect to my own email address. I am selecting “SMTP” as the Send Emails protocol and I am not ticking the Receive Emails box.  Any help would be greatly appreciated, I’m not sure what I’m doing wrong.  Many thanks.
asked
5 answers
8

Hii, 

Hartley Robinson.

 

You will need to set up the Model Reflection module and the Encryption module. Add the Model Reflection administration page to your navigation; the page is called “MxObjects_Overview.” Then expand the encryption module and set a value for the constant called “EncryptionKey;” this value needs to be a sixteen-character string.

(Helpful Hint: Press CTRL + G to search for pages, microflows, or resources)

02 (1000×563) (squarespace-cdn.com)

 

Now you can run your project. You can choose to run locally or to deploy to your sandbox. Once the project has compiled, click “View” to have it open in a browser.

 

When you open your project, the screen you land on is your home page. The first thing you should do is navigate to your Model Reflection administration page and press the “Click to Refresh” button, (make sure to check the EmailCustom module).

 

Next, navigate to the email administration page and perform the first-time setup. I like to use a Gmail address to send emails, but you can use any SMTP settings.

The settings for a Gmail account are:

·         Gmail SMTP server address: smtp.gmail.com

·         Gmail SMTP username: Your full Gmail address (e.g., yourusername@gmail.com)

·         Gmail SMTP password: Your Gmail password

·         Gmail SMTP port (TLS): 587

·         Gmail SMTP port (SSL): 465

 

 

Once you have entered your credentials, you can click the “next” button and proceed with sending a test email.

Most of the time Gmail will block your Mendix app until you turn on the “Allow Less Secure Apps” setting. If you run into this issue, the error that will be returned will be that your password is incorrect. To allow less secure apps check out this Google article. 

If your email went through, congrats! You have just setup email functionality in your Mendix app. Now to take this a step further, let’s setup a template with a token, and then send an email from a microflow.

 

The first thing you should do is open the “My First Template” example. Then scroll to the bottom and find the ‘tokens” section. Here is where you can link an entity and its attributes from your database to your email templates. For this example, we will use the “EmailInfo” table in the EmailCustom module.

The select object would be “email info” and then you can press “new” to create a token for each attribute in your selected object. In our case, there will only be one attribute in the email info table that we can create a token.

The “token” field would be the name of your token, the “type” would be the attribute, and the “attribute” field is where you would select “info.” When that is created you can add your token to the body of the email. To call your token you need curly braces and a percent sign around the name of your token. In this example, our token would be “{%TestToken%}". Now that your template is created, you can use it in a microflow to send an email. In the EmailCustom module that I created, there is a microflow called “Example_SendEmail.” Right-click this microflow to include it in your project, and then put an email address in the email address variable. Or create your own microflow from this example.

Once that is done you can add this button to a page anywhere in your app to conduct the test.

 

Next run your application and then press the button that you just added. There will be a popup message if your email was successful, and you should receive an email in your inbox.

 

If you received the email then congrats! You just sent your first test email!

 

Thank You!!!

 

answered
2

Hi Hartley Robinson ,

 

you can see this documentation for more information 

 

Email connector

 

Thank you !!

answered
2

I found the issue that was causing my application’s Email Connector setup not to work.

It was a JAR file issue.

 

The file javax.mail-1.6.0.jar that existed in the userlib was causing problems.

 

Steps followed:

  1. Locate the JAR file in the project userlib
  2. Remove this file (keep a back-up)
  3. Before running the application clear the deployment directory
  4. Run the application 

That said the JAR file causing this for you may not be the javax.mail-1.6.0.jar file as well. In that case I recommend that a comparison of a new app where the Email Connector module has been imported against the existing application.

answered
0

Who’s your email provider? If it’s a Gmail account you need to generate an app password for Mendix to use. Let me know, I spent a good month battling with the Email Connector when we migrated to it.

answered
0

Refer documentation

 

Before you use the Email connector in your app, do the following:

  1. Download and configure the latest version of Mx Model Reflection module. If you have the module already, ensure that it is up-to-date.
  2. Download and configure the latest version of the Encryption module. If you have the module already, ensure that it is up-to-date.
  3. Remove any existing email modules (IMAP/POP3 or Email Module with Templates).
  4. Check for and remove orphaned JAR files from any old email modules in the userlib subdirectory (for example, javax.mail-1.6.2.jar and activation-1.1.jar).
  5. Clean the deployment directory before running the app.
answered