Sending mail in Mendix 5

1
Has anyone already implemented sending mail in Mendix 5? I tried and tried but still no success. The java functions in the distinct mail modules in the App Store won't compile.
asked
4 answers
1

This probably has to do with the fact that we used to include the mail.jar for external use. This module relies on this and does not seem to be updated yet for Mendix 5. You could probably solve this by downloading the mail.jar (also see http://stackoverflow.com/questions/6606529/package-javax-mail-and-javax-mail-internet-do-not-exist) and putting it in your resources folder.

You could even copy it from an older Mendix installation, for example C:\Program Files (x86)\Mendix\4.6.1\runtime\lib\mail.jar

Update after your answer: Looks like you're also definitely missing the apache StringUtils package which you can also find on the internet. And then some other things like a Base64 library.

What probably would be easiest to do at this point is to simply copy all libraries of the Mendix 4 installation's lib folder. Then when a proper Mendix 5 version of this module gets released you can still keep what's required at that point.

answered
1

I fixed my problems.

I had to edit three files:

javasource\emailtemplate\actions\SendEmail.java:

   change import com.mendix.log.ILogNode to import com.mendix.logging.ILogNode;

javasource\mxmodelreflection\metamodelBuilder\MetaObjectBuilder.java and MicroflowBuilder.java:

change import org.apache.commons.lang.StringUtils; to:  import org.apache.commons.lang3.StringUtils; (add a '3' to lang)
answered
0

I downloaded several jars, like mail.jar, but also axis2-kernel-1.1.jar and axis2-1.5.1.jar, as a missing package is org.apache.axis2.util, which should be one of these jars.

First error message is:

[javac] C:\!data\Mendix\MyApplication\javasource\emailtemplate\actions\Decrypt
[javac] import org.apache.axis2.util.Base64;

I placed these jars in C:!data\Mendix\MyApplication\resources, but still it won't compile. I also made a subdirectory, C:!data\Mendix\MyApplication\resources\mail, and placed mail.jar in i without result.

What exact directory do I need to copy it to? Or do I need to unpack it first?

answered
0

@Basvandenbroek (2013-11-07):

I tried Emailtokenstemplate and MxSMTP.

For Mendix 5, jars must not be placed in the Resource folder, but in Userlib. I had to create this directory myself, it wasn't there at first.

After placing 7 jars (antisamy-1.4.4.jar, axis2-kernel-1.1.jar, commons-email-1.3.1.jar, commons-lang3-3.1.jar, mail.jar, replication.jar), I still have 8 errors. But that's already a start, first I got 20 errors:

> compile:
>     [javac] Compiling 50 source files to
> C:\!data\Mendix\MyApp\deployment\run\bin
>     [javac] C:\!data\Mendix\MyApp\javasource\emailtemplate\actions\SendEmail.java:15:
> package com.mendix.m2ee.log does not
> exist
>     [javac] import com.mendix.m2ee.log.ILogNode;
>     [javac]                           ^
>     [javac] C:\!data\Mendix\MyApp\javasource\emailtemplate\actions\SendEmail.java:150:
> cannot find symbol
>     [javac] symbol  : class ILogNode
>     [javac] location: class emailtemplate.actions.SendEmail
>     [javac]   private ILogNode _logNode = Core.getLogger(this.toString());
>     [javac]           ^
>     [javac] C:\!data\Mendix\MyApp\javasource\mxmodelreflection\metamodelBuilder\MetaObjectBuilder.java:18:
> package org.apache.commons.lang does
> not exist
>     [javac] import org.apache.commons.lang.StringUtils;
>     [javac]                               ^
>     [javac] C:\!data\Mendix\MyApp\javasource\mxmodelreflection\metamodelBuilder\MicroflowBuilder.java:12:
> package org.apache.commons.lang does
> not exist
>     [javac] import org.apache.commons.lang.StringUtils;
>     [javac]                               ^
>     [javac] C:\!data\Mendix\MyApp\javasource\mxmodelreflection\metamodelBuilder\MetaObjectBuilder.java:334:
> cannot find symbol
>     [javac] symbol  : variable StringUtils
>     [javac] location: class mxmodelreflection.metamodelBuilder.MetaObjectBuilder
>     [javac]       associationObject.setValue(context,
> MxObjectReference.MemberNames.Name.toString(),
> StringUtils.substringAfter(name,
> "."));
>     [javac]                                                                                          ^
>     [javac] C:\!data\Mendix\MyApp\javasource\mxmodelreflection\metamodelBuilder\MetaObjectBuilder.java:335:
> cannot find symbol
>     [javac] symbol  : variable StringUtils
>     [javac] location: class mxmodelreflection.metamodelBuilder.MetaObjectBuilder
>     [javac]       associationObject.setValue(context,
> MxObjectReference.MemberNames.Module.toString(),
> StringUtils.substringBefore(name,
> "."));
>     [javac]                                                                                            ^
>     [javac] C:\!data\Mendix\MyApp\javasource\mxmodelreflection\metamodelBuilder\MicroflowBuilder.java:43:
> cannot find symbol
>     [javac] symbol  : variable StringUtils
>     [javac] location: class mxmodelreflection.metamodelBuilder.MicroflowBuilder
>     [javac]           String moduleName = StringUtils.substringBefore(microflowName,
> ".");
>     [javac]                               ^
>     [javac] C:\!data\Mendix\MyApp\javasource\mxmodelreflection\metamodelBuilder\MicroflowBuilder.java:50:
> cannot find symbol
>     [javac] symbol  : variable StringUtils
>     [javac] location: class mxmodelreflection.metamodelBuilder.MicroflowBuilder
>     [javac]                   obj.setValue(context, Microflows.MemberNames.Name.toString(),
> StringUtils.substringAfter(microflowName,
> "."));
>     [javac]                                                                                 ^
>     [javac] Note: C:\!data\Mendix\MyApp\javasource\com\mendix\core\Core.java
> uses or overrides a deprecated API.
>     [javac] Note: Recompile with -Xlint:deprecation for details.
>     [javac] Note: C:\!data\Mendix\MyApp\javasource\com\mendix\core\Core.java
> uses unchecked or unsafe operations.
>     [javac] Note: Recompile with -Xlint:unchecked for details.
>     [javac] 8 errors
answered