Email Module With Template: Sending mail from App to a Gmail Account

0
Hi, My use-case is : When a new user is created by Admin, the user should receive a mail with a custom login link. I am using the ‘Email Module with Templates’ module from App store in my project.  In the server configurations of the module, I have mentioned the SMTP server of my organization. When I try to send an email within my organization (SMTP port 25), it works correctly. But when I try to send email from my organization email id to another gmail account (using port 25), I get the error “550 5.7.1 unable to relay”. When I use port 587 (without checking the box of TLS), I get the error “530 5.7.1 Client was not authenticated”.   I searched for solutions online. It mentioned that ideally my organization’s SMTP should contact Gmail SMTP directly (or any other SMTP according to the recipient’s email ID) and it should work correctly, but still I am getting the same error while sending mails from app to any other Mail ID outside my organization’s SMTP domain. Also, for the Gmail Account, I have kept the ‘Allow Less Secure Apps’ to connect option on (since that was one of the solutions mentioned).   Pls. let me know how I can solve the error and send mails to different recipients (from different domains).   Edit: I have set the server configurations to Gmail SMTP server. The ‘Test’ works correctly. But when I try to save the server configuration as the Gmail SMTP server, I am getting error: ‘An error occured,  pls contact system administrator’. Stack trace: (Mendix logs)(3 errors total) Encryption Node: Error while encrypting string: Key length should be 16 Connector Node:  An error has occurred while handling the request. [User 'MxAdmin' with session id '56938384-XXXX-XXXX-XXXX-XXXXXXXXfca6' and roles 'Administrator'] -------- com.mendix.core.CoreException: com.mendix.modules.microflowengine.MicroflowException: Failed to commit     at EmailTemplate.IVK_SaveEmailSettings (Change : 'Change 'EmailSettings' ')     at EmailTemplate.IVK_SaveEmailSettingsFromTestMessage (SubMicroflow : 'IVK_SaveEmailSettings') Advanced stacktrace:     at com.mendix.basis.component.InternalCoreBase.execute(InternalCoreBase.java:354) Caused by: com.mendix.modules.microflowengine.MicroflowException: Failed to commit     at EmailTemplate.IVK_SaveEmailSettings (Change : 'Change 'EmailSettings' ')     at EmailTemplate.IVK_SaveEmailSettingsFromTestMessage (SubMicroflow : 'IVK_SaveEmailSettings') Advanced stacktrace:     at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:146) Caused by: com.mendix.core.CoreRuntimeException: Failed to commit     at com.mendix.basis.component.CommitHandler.commit(CommitHandler.scala:161) Caused by: com.mendix.core.CoreRuntimeException: com.mendix.modules.microflowengine.MicroflowException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: Key length should be 16     at Encryption.Encrypt (Error : '')     at EmailTemplate.BCo_EmailSettings (SubMicroflow : 'Encrypt')     at {"before":[{},{}],"action":{"type":"CommitAction"},"after":[],"type":"EventExtendedAction"}     at EmailTemplate.IVK_SaveEmailSettings (Change : 'Change 'EmailSettings' ')     at EmailTemplate.IVK_SaveEmailSettingsFromTestMessage (SubMicroflow : 'IVK_SaveEmailSettings') Advanced stacktrace:     at com.mendix.basis.actionmanagement.ActionManagerBase.executeInTransactionSync(ActionManagerBase.java:123) Caused by: com.mendix.modules.microflowengine.MicroflowException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: Key length should be 16     at Encryption.Encrypt (Error : '')     at EmailTemplate.BCo_EmailSettings (SubMicroflow : 'Encrypt')     at {"before":[{},{}],"action":{"type":"CommitAction"},"after":[],"type":"EventExtendedAction"}     at EmailTemplate.IVK_SaveEmailSettings (Change : 'Change 'EmailSettings' ')     at EmailTemplate.IVK_SaveEmailSettingsFromTestMessage (SubMicroflow : 'IVK_SaveEmailSettings') Advanced stacktrace:     at com.mendix.modules.microflowengine.microflow.impl.ErrorEvent.throwError$1(ErrorEvent.scala:17) Caused by: com.mendix.core.CoreException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: Key length should be 16     at com.mendix.basis.component.InternalCoreBase.execute(InternalCoreBase.java:383) Caused by: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: Key length should be 16     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:156) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: Key length should be 16     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: Key length should be 16     at encryption.actions.EncryptString.executeAction(EncryptString.java:44)     at encryption.actions.EncryptString.executeAction(EncryptString.java:19)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:147)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152)     at com.mendix.basis.component.InternalCoreBase.execute(InternalCoreBase.java:379)     at com.mendix.modules.microflowengine.actions.actioncall.JavaAction.execute(JavaAction.scala:53)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:201)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:157)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:147)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152)     at com.mendix.basis.component.InternalCoreBase.executeSync(InternalCoreBase.java:409)     at com.mendix.modules.microflowengine.MicroflowExecuter$.executeSync(MicroflowExecuter.scala:19)     at com.mendix.modules.microflowengine.actions.SubMicroflowAction.execute(SubMicroflowAction.scala:49)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:201)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:157)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:147)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152)     at com.mendix.basis.component.InternalCoreBase.executeSync(InternalCoreBase.java:409)     at com.mendix.basis.actionmanagement.SyncEventExtendedAction.executeBeforeAction(SyncEventExtendedAction.java:78)     at com.mendix.basis.actionmanagement.SyncEventExtendedAction.executeBeforeActionsSync(SyncEventExtendedAction.java:58)     at com.mendix.basis.actionmanagement.SyncEventExtendedAction.executeAction(SyncEventExtendedAction.java:32)     at com.mendix.basis.actionmanagement.EventExtendedAction.execute(EventExtendedAction.java:102)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:150)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeInTransactionSync(ActionManagerBase.java:116)     at com.mendix.basis.component.CommitHandler.$anonfun$storeObjectsAndAutoCommittedObjects$1(CommitHandler.scala:208)     at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:238)     at scala.collection.immutable.List.foreach(List.scala:392)     at scala.collection.TraversableLike.map(TraversableLike.scala:238)     at scala.collection.TraversableLike.map$(TraversableLike.scala:231)     at scala.collection.immutable.List.map(List.scala:298)     at com.mendix.basis.component.CommitHandler.storeObjectsAndAutoCommittedObjects(CommitHandler.scala:206)     at com.mendix.basis.component.CommitHandler.commit(CommitHandler.scala:133)     at com.mendix.basis.component.CommitHandler.commit$(CommitHandler.scala:111)     at com.mendix.basis.component.InternalCore.commit(InternalCore.scala:39)     at com.mendix.basis.component.CommitHandler.commitWithEvents(CommitHandler.scala:70)     at com.mendix.basis.component.CommitHandler.commit(CommitHandler.scala:29)     at com.mendix.basis.component.CommitHandler.commit$(CommitHandler.scala:28)     at com.mendix.basis.component.InternalCore.commit(InternalCore.scala:39)     at com.mendix.basis.component.CommitHandler.commit(CommitHandler.scala:24)     at com.mendix.basis.component.CommitHandler.commit$(CommitHandler.scala:24)     at com.mendix.basis.component.InternalCore.commit(InternalCore.scala:39)     at com.mendix.modules.microflowengine.actions.mxobject.ChangeItemsExecutor.executeChanges(ChangeItemsExecutor.scala:62)     at com.mendix.modules.microflowengine.actions.mxobject.ChangeItemsExecutor.executeChanges$(ChangeItemsExecutor.scala:28)     at com.mendix.modules.microflowengine.actions.mxobject.ChangeAction.executeChanges(ChangeAction.scala:20)     at com.mendix.modules.microflowengine.actions.mxobject.ChangeAction.execute(ChangeAction.scala:50)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:201)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:157)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:147)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152)     at com.mendix.basis.component.InternalCoreBase.executeSync(InternalCoreBase.java:409)     at com.mendix.modules.microflowengine.MicroflowExecuter$.executeSync(MicroflowExecuter.scala:19)     at com.mendix.modules.microflowengine.actions.SubMicroflowAction.execute(SubMicroflowAction.scala:49)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:201)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:157)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:147)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152)     at com.mendix.basis.component.InternalCoreBase.execute(InternalCoreBase.java:348)     at com.mendix.basis.component.InternalCoreBase.execute(InternalCoreBase.java:363)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.runMicroflow(ExecuteMicroflowAction.scala:75)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.apply(ExecuteMicroflowAction.scala:40)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.apply(ExecuteMicroflowAction.scala:18)     at com.mendix.webui.actions.client.RegularClientAction.$anonfun$execute$7(RegularClientAction.scala:63)     at com.mendix.webui.requesthandling.helpers.StateHandling.withState(StateHandling.scala:37)     at com.mendix.webui.requesthandling.helpers.StateHandling.withState$(StateHandling.scala:30)     at com.mendix.webui.actions.client.RegularClientAction.withState(RegularClientAction.scala:30)     at com.mendix.webui.actions.client.RegularClientAction.$anonfun$execute$3(RegularClientAction.scala:61)     at scala.util.Try$.apply(Try.scala:213)     at com.mendix.webui.actions.client.RegularClientAction.$anonfun$execute$2(RegularClientAction.scala:54)     at com.mendix.webui.actions.client.RegularClientAction.$anonfun$execute$2$adapted(RegularClientAction.scala:53)     at com.mendix.webui.requesthandling.helpers.ContextHandling.$anonfun$inContext$5(ContextHandling.scala:47)     at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)     at com.mendix.basis.actionmanagement.IMonitoredAction$$anon$1.execute(IMonitoredAction.scala:47)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.basis.actionmanagement.IMonitoredAction.monitor(IMonitoredAction.scala:49)     at com.mendix.basis.actionmanagement.IMonitoredAction.monitor$(IMonitoredAction.scala:25)     at com.mendix.webui.requesthandling.helpers.ContextHandling$ClientMonitoredAction.monitor(ContextHandling.scala:59)     at com.mendix.webui.requesthandling.helpers.ContextHandling.inContext(ContextHandling.scala:47)     at com.mendix.webui.requesthandling.helpers.ContextHandling.inContext$(ContextHandling.scala:27)     at com.mendix.webui.actions.client.RegularClientAction.inContext(RegularClientAction.scala:30)     at com.mendix.webui.requesthandling.helpers.ContextHandling.inContext(ContextHandling.scala:24)     at com.mendix.webui.requesthandling.helpers.ContextHandling.inContext$(ContextHandling.scala:19)     at com.mendix.webui.actions.client.RegularClientAction.inContext(RegularClientAction.scala:30)     at com.mendix.webui.actions.client.RegularClientAction.$anonfun$execute$1(RegularClientAction.scala:53)     at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)     at com.mendix.webui.requesthandling.helpers.ProfileHandling.profileRequest(ProfileHandling.scala:14)     at com.mendix.webui.requesthandling.helpers.ProfileHandling.profileRequest$(ProfileHandling.scala:10)     at com.mendix.webui.actions.client.RegularClientAction.profileRequest(RegularClientAction.scala:30)     at com.mendix.webui.actions.client.RegularClientAction.execute(RegularClientAction.scala:50)     at com.mendix.webui.requesthandling.ClientRequestHandler.handleAction(ClientRequestHandler.scala:130)     at com.mendix.webui.requesthandling.ClientRequestHandler.processRequest(ClientRequestHandler.scala:107)     at com.mendix.externalinterface.connector.RequestHandler.doProcessRequest(RequestHandler.java:40)     at com.mendix.external.connector.MxRuntimeConnector$1.execute(MxRuntimeConnector.java:76)     at com.mendix.external.connector.MxRuntimeConnector$1.execute(MxRuntimeConnector.java:73)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.external.connector.MxRuntimeConnector.processRequest(MxRuntimeConnector.java:79)     at com.mendix.basis.impl.MxRuntimeImpl.processRequest(MxRuntimeImpl.java:963)     at com.mendix.m2ee.appcontainer.server.handler.RuntimeHandler.service(RuntimeHandler.java:42)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)     at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:867)     at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:542)     at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)     at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588)     at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)     at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)     at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)     at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)     at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557)     at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)     at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)     at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)     at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)     at org.eclipse.jetty.server.Server.handle(Server.java:502)     at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)     at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)     at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)     at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)     at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)     at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)     at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)     at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)     at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)     at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)     at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)     at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)     at java.base/java.lang.Thread.run(Thread.java:834)   Client node:  An error occurred while executing On click at EmailTemplate.TestMessage_SendResult.actionButton1:  Error: An error occurred while executing On click at EmailTemplate.TestMessage_SendResult.actionButton1:     at Anonymous function (http://localhost:8080/mxclientsystem/mxui/mxui.js?637157293348565130:73:302009)    at ve (http://localhost:8080/mxclientsystem/mxui/mxui.js?637157293348565130:35:8720)    at r (http://localhost:8080/mxclientsystem/mxui/mxui.js?637157293348565130:35:8618)    at m (http://localhost:8080/mxclientsystem/mxui/mxui.js?637157293348565130:40:140472)    at Anonymous function (http://localhost:8080/mxclientsystem/mxui/mxui.js?637157293348565130:46:199306)    at r (http://localhost:8080/mxclientsystem/mxui/mxui.js?637157293348565130:46:202469)
asked
2 answers
0

I think you should contact the administrator of your organization mail server. I would advice to use port 587 and the TLS option. But that is something your administrator must set up. We let the administrator always setup a special account for the Mendix applications and use that account to sent mail. If you see that mail is not sent from your organizations mail server to google accounts contact your administrator and let him pinpoint the problem.

Regards,

Ronald

 

answered
0

Dears,,

use the below :

Server configuration: smtp.gmail.com

Use SSL: true

Port:465

User name :  fill your email

Password : fill your email password

From address : fill your email

 

Note: make sure to enable sending flag from advanced setting  from your email setting .

answered