mail.sendMail Error

Hi all!

I´m trying to use plugin mail and I had this error. See image error_mail.png

I have this code. See image mail_code.png

and the value of params is:

=>vProperties
[“mail.smtp.host=smtp.gmail.com",“mail.smtp.auth=true”,“mail.smtp.starttls.enable=true”,“mail.smtp.port=587”,"mail.smtp.username=ivan@gmail.com”,“mail.smtp.password=xxxxx”]
=>vMsgText
“Usuario: ivan
Password: XXXXXX”
=>vUserFs.email
“ivan.otero@neocursar.info”

Hi Ivan,

Your error comes from the mailserver. Does it support TLS connections ?

I send the configuration of server plugins.

It appears in http://localhost:8080/servoy-admin/plugin-settings twice

Hi Ivan,

The “mail.smtp.starttls.enable” property is not listed in the servoy admin page. Perhaps this property is not supported (although it’s part of the JavaMail API) in the Servoy mail plugin. Try to use “mail.smtp.ssl.enable” instead.

Hope this helps.

Hi ROCLASI!

I was trying with this other property but it has the same behabiour.

I use now

	    vProperties[0] = 'mail.smtp.host=smtp.gmail.com';
		    vProperties[1] = 'mail.smtp.auth=true';
		    vProperties[2] = 'mail.smtp.ssl.enable=false';

instead of

vProperties[2] = 'mail.smtp.starttls.enable=false';

As I see in Java Mail Api.

mail.smtp.ssl.enable boolean If set to true, use SSL to connect and use the SSL port by default. Defaults to false for the “smtp” protocol and true for the “smtps” protocol.

Could you send me a sample solution which use plugin mail.

Does anybody have a working example of gmail smtp?
I’ve checked several posts but i keep getting
java.lang.Exception: 530 5.7.0 Must issue a STARTTLS command first. v51sm5671387eeh.16

Firewall is set on port 465 and 587
Both aren’t working for me.

I’m using this snippet:

	var _properties = new Array();
	_properties[0] = 'mail.smtp.host=smtp.gmail.com';
	_properties[1] = 'mail.smtp.auth=true';
	_properties[2] = 'mail.smtp.username=x@x.com';
	_properties[3] = 'mail.smtp.password=xxxxx;
	_properties[4] = 'mail.smtp.port=465';
	_properties[5] = 'mail.smtp.starttls.enable=true';
	return _properties;

This code is working based on Patrick’s MailPro plugin - SMTP port is set to 25.

   //   SMTPAccount Create an "empty" SMTP account
   var vSmtp = plugins.MailPro.SMTPAccount();

   vSmtp.host 		= gcurr_em_account.smtp_server;               //  smtp.gmail.com
   vSmtp.userName 	= gcurr_em_account.account_username;     //   john@xxx.com
   vSmtp.password 	= gcurr_em_account.account_password;     //   password
   vSmtp.requiresAuthentication = true;
   vSmtp.useTSL 	= true;
	
   // Connect
   var vSuccess = vSmtp.connect();

HTH