sendMail() in Mail Plugin not working?

Hi,
I am new to Mail Plugin.
I am creating a test mail application.
Here is the code.

var success = plugins.mail.sendMail( globals.to, globals.from, globals.subject , globals.message);

if (!success) 
{
	plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}

But Not working.

Please, any help?

did you fill in an SMTP server in your preference panel? or servoy-admin pages?

Let me check…

Yaa,
I have mentioned that, still not working?

Do you see anything in the servoy log?
And does globals.message contain any text? I seem to remember it needs to have any text. I always add a space to the message variable to be safe.
Also do you have access to the SMTP server log? It would contain more information on why it’s not working.

Hope this helps.

Thanks ROCALSI,

Let me check that…

yaa,
the globals.message contains some text.
How can i access to SMTP Server log?

aaaaa:
How can i access to SMTP Server log?

You need to have (admin) access to your mailserver for that using ssh (shell) or via a webportal like Plesk.

Hi ‘aaaa’,

You say that it is not working but you are not saying anything about how it fails.

Do you get the dialogue telling you that it has failed to send the mail or do you get any other error ?

Have you tried to replace the ‘globals.xxx’ values in the sendMail function with hard coded data to see if it works ?

var success = plugins.mail.sendMail( "fred@b.com", "aaa@a.com", "Hello World" , "Call Me back when you have a minute");

There is a function in the mail plugin: ```
plugins.mail.getLastSendMailException()


You may also be needing SMTP authentication and so you might also be wise to check your Servoy server logs to see if anything is recorded there

Cheers
Harry

Out of curiousity, why are there more mail options on the servoy-admin page “Servoy Server Plugin Settings” than in the Prefs Panel within Servoy Developer?
e.g.
mail.smtp.auth:
mail.smtp.username:
mail.smtp.password:

can’t be set from the Developer Prefs panel