I have the following method that suppose to send email to the users:
//globals.tx3 gets populated with the users email address
var user = globals.tx3
// task_name projects task name
var msgText = task_name
// project_description
var projdsc = project_description
// Projects comments
var comm = comments
var succes = plugins.mail.sendMail(‘user ,to_someone_else@testing.com’, ‘From Servoy XMLR Projectabk@stanford.edu’, ‘XMRL project has been assigned to you’, msgText + projdsc,null,‘unnamed@testing.com’);
if (!succes)
{
plugins.dialogs.showWarningDialog(‘Alert’,‘Failed to send mail’,‘OK’);
}
The globals.tx3 gets updated with the user’s email address.
When I replace the email address with the variable user in var succes = plugins.mail.sendMail(‘user ,to_someone_else@testing.com’, servoy errors out.
var succes = plugins.mail.sendMail(user ,'to_someone_else@testing.com', 'From Servoy XMLR Project<abk@stanford.edu>', 'XMRL project has been assigned to you', msgText + projdsc,null,'unnamed@testing.com');
if (!succes)
{
plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}
// task_name projects task name
var msgText = task_name
// project_description
var projdsc = project_description
// Projects comments
var comm = comments
var succes = plugins.mail.sendMail(user ,‘to_someone_else@testing.com’, ‘From Servoy XMLR Projectabk@stanford.edu’, ‘XMRL project has been assigned to you’, msgText + projdsc,null,‘unnamed@testing.com’);
if (!succes)
{
plugins.dialogs.showWarningDialog(‘Alert’,‘Failed to send mail’,‘OK’);
}
Make sure you have your mail plug-in settings correct. Go into preferences on the mail tab to set your server - then go into the SERVER (http://yourip:port/servoy-admin) and look on the main page for any authentication information that you may need to provide.
The mail plug-in is working fine.
If I replace user with abk@stanford.edu, then Servoy will send the email fine.
If I change:
var succes = plugins.mail.sendMail(user, ‘abk@stanford.edu’, ‘From Servoy XMLR Projectabk@stanford.edu’, ‘XMRL project has been assigned to you’, msgText + projdsc,null,‘abk@stanford.edu’);
if (!succes)
{
plugins.dialogs.showWarningDialog(‘Alert’,‘Failed to send mail’,‘OK’);
}
To:
var succes = plugins.mail.sendMail(‘abk@stanford.edu, abk@stanford.edu’, ‘From Servoy XMLR Projectabk@stanford.edu’, ‘XMRL project has been assigned to you’, msgText + projdsc,null,‘abk@stanford.edu’);
if (!succes)
{
plugins.dialogs.showWarningDialog(‘Alert’,‘Failed to send mail’,‘OK’);
}
Then, it works fine, but I need to use “user”. Why? Because that filed gets updated with different email address each time users create a new record.
Please let me know if there is a better way to deal with this.
var from = bedrijf_voorkeuren.email_werk ;
var subject = titel ;
var msgText = omschrijving ;
var version = globals.gVersion ;
var succes = plugins.mail.sendMail('info@freecolours.com', from, version + subject, msgText,null,null);
if (!succes)
{
plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}
But the server gives me this error:
SMTPSend javax.mail.SendFailedException: Sending failed; nested exception is: class javax.mail.MessagingException: 553 testbedrijf.nl does not exist
The actual e-mailaddress is info@testbedrijf.nl, so it misses the ‘info@’…
I guess there is something wrong with the ‘from’ code?