“SMTPSend Could not connect to SMTP host: smtp.gmail.com, port: 587”
This error occured when i send mail . Why i can’t send and connect to SMTP? Can anyone help me? How can i solve this problem? Please…
Thanks
“SMTPSend Could not connect to SMTP host: smtp.gmail.com, port: 587”
This error occured when i send mail . Why i can’t send and connect to SMTP? Can anyone help me? How can i solve this problem? Please…
Thanks
For google SMTP, you need authentication and STARTTLS. A simple SMTP setup without this will not work. Look around the forum, I think other people had this problem, too.
Found one: viewtopic.php?f=15&t=11855
var authorization = new Array(“mail.smtp.host=smtp.gmail.com”, “mail.smtp.auth=true”, “mail.smtp.starttls.enable=true”, “mail.smtp.port=587”, “mail.smtp.username=servoytest@gmail.com”, “mail.smtp.password=mypassword”);
var emailSend = “sannaingtun@gmail.com”;
var emailFrom = “servoytest@gmail.com”;
var emailSubject = “SMTP help”;
var emailMsg = “test code”;
var success = plugins.mail.sendMail(emailSend, emailFrom, emailSubject, emailMsg, null, null, null, authorization );
I used above code but the same error occured…
did you try? ```
mail.smtp.port=465
port 587 doesn't always seem to work...
yeah , i have tried…
Actually I also tried for mail plugin from servoy but i got the same error.
I follow what the forum say and finally still get the error.
this is my email code in servoy, but it didn’t work.
==============================================================================================================
function sendEmail()
{
var authorization = new Array(“mail.smtp.host=smtp.gmail.com”, “mail.smtp.auth=true”, “mail.smtp.starttls.enable=true”, “mail.smtp.port=465”, “mail.smtp.username=servoytest@gmail.com”, “mail.smtp.password=<<My Real Password For servoytest@gmail.com>>”);
var emailTo = “amchtwe@gmail.com”;
var emailFrom = “servoytest@gmail.com”;
var emailSubject = “SMTP help”;
var emailMsg = “test code”;
var success = plugins.mail.sendMail(emailTo, emailFrom, emailSubject, emailMsg, null, null, null, authorization );
if (success)
{
elements.lblMsg.text=“success.”
}
else
{
elements.lblMsg.text=“failed to send.”
}
}
==============================================================================================================
If you have some idea or some experience let me know.
For now, i got the error that is “Connection time out”.
The following is the trace information from my server_log.txt file
==============================================================================================================
com.servoy.j2db.util.Debug - SMTPSend Could not connect to SMTP host: smtp.gmail.com, port: 465
javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
nested exception is:
java.net.ConnectException: Connection timed out: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
at javax.mail.Service.connect(Service.java:310)
at javax.mail.Service.connect(Service.java:169)
at javax.mail.Service.connect(Service.java:118)
at javax.mail.Transport.send0(Transport.java:188)
at javax.mail.Transport.send(Transport.java:118)
at com.servoy.extensions.plugins.mail.MailServer.sendMail(MailServer.java:300)
at com.servoy.extensions.plugins.mail.MailProvider.js_sendMail(MailProvider.java:257)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:179)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:347)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3666)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2680)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:166)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3125)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:165)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:37)
at com.servoy.j2db.scripting.RemoteDebugScriptEngine.executeFunction(RemoteDebugScriptEngine.java:18)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:64)
at com.servoy.j2db.FormController.Za(FormController.java:68)
at com.servoy.j2db.FormController.executeFunction(FormController.java:309)
at com.servoy.j2db.FormController.actionPerformed(FormController.java:688)
at com.servoy.j2db.Zhb.actionPerformed(Zhb.java:7)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1359)
… 52 more
==============================================================================================================
Just another thought: is it technically possible to connect to this port, so:
a) did you check if there’s a firewall which blocks your connection
b) Your internet-provider may be so ‘kind’ to NOT let you connect to this port for security reasons…
Please keep in mind that the mail is actually send out from the server, so that’s the place you should check your connections from…
Hope this helps?!