Failed to send emai to more then two users

Hi all,

I’m trying to send email to four users by using the following method, but I get “Failed to send email” error:

// users name and email address
var user1 = email_address
var user2 = email_address2
var user3 = email_address3
var user4 = email_address4
var Taskdesc = "task_description: " //Header
var TASKDESC = task_description //project_description filed
var retrn = “\r” //return to the next line
var tsname = "Task_name: " //Header
var msgText = task_name //task_name field
var com = "Comments: " //Header
var comm = comments //comments field

var succes = plugins.mail.sendMail(user1+ ‘, abk@stanford.edu’, ‘From Servoy Database Projectabk@stanford.edu’, ‘XMRL Project notification’, tsname + msgText + retrn + TASKDESC + Taskdesc + retrn + com + comm ,null,‘user3 +, user4’);

if (!succes)
{
plugins.dialogs.showWarningDialog(‘Alert’,‘Failed to send mail’,‘OK’);
}

Any help I would appreciate,

Thanks,

Abrahim

Looks like you’re mixing up the quotes here:```
‘user3 +, user4’


Paul

Paul,

Any suggestion on how to correct 'user3 +, user4?

Thanks in advance,

Abrahim

Currently, you pass the literal text 'user3 +, user4 as param, and I think that’s not what you’re trying to do.

I assume you’re trying to pass two emailaddresses as BCC?

Try then:
user3+‘,’+user4

Paul

I changed the line to:

var succes = plugins.mail.sendMail(user1+ ‘, abk@stanford.edu’, ‘From Servoy Database Projectabk@stanford.edu’, ‘XMRL Project notification’, tsname + msgText + retrn + TASKDESC + Taskdesc + retrn + com + comm ,null,‘user3+’,‘+user4’);

Still errors.

According to the manual:
//plugins.mail.sendMail( to, from, subject, msgText, [cc], [bcc], [attachment/attachments array])

I’m tying to [cc], [bcc], or any other way that I could send email to the multiple users.

Thanks,

Abrahim

You’re now sending the literal text: ‘user3+’ and additionally ‘+user4’

If you put quotes around something, Servoy sees it as text. Now, because you have the quotes in the middle around the comma, you’re passing two individual params, one with text user3+ and one with text +user4

Loose the surounding qoutes and it’ll work… If you want the value of a variable, don’t put quotes around the variable, because then it’s not a variablename anymore, but regular text.

You’ve got to master the quoting, or alse you’re in for some nasty debuggin’ :lol:

Paul

Paul,

I’ll remember the quoting.

Thanks for the help,

Regards,

Abrahim