Difference between revisions of "BulkMail sendSyncronious"

From Catglobe Wiki
Jump to: navigation, search
Line 7: Line 7:
 
'''Syntax'''
 
'''Syntax'''
  
BulkMail_sendSyncronious(number Bulk_mail_resource_id[,number MaxToSend]);
+
BulkMail_sendSyncronious(number BulkmailRId[,number MaxToSend][, callbackWithAmount]);
  
 
'''Arguments'''
 
'''Arguments'''
  
Bulk_mail_resource_id: Is a numeric (non-decimal) expression. It is the resource id of the bulk mail.<br/>MaxToSend: Is a numeric (non-decimal) expression. It is the max email which send.
+
BulkmailRId: Is a numeric (non-decimal) expression. It is the resource id of the bulk mail.<br/>MaxToSend: Is a numeric (non-decimal) expression. It is the max email which send.<br/>callbackWithAmount: any type
  
 
'''Return value'''
 
'''Return value'''
Line 21: Line 21:
 
<source lang="javascript">
 
<source lang="javascript">
 
number a=BulkMail_sendSyncronious(15551353,1);
 
number a=BulkMail_sendSyncronious(15551353,1);
//result:
+
//result: 1
 +
</source>
  
1
+
<source lang="javascript">
 +
number sent = BulkMail_sendSyncronious(bm[BULKMAIL_RESOURCE_ID], limit, function(number nrSending) {
 +
//3400 == n mails, plus n*3 questions
 +
bool hasEnough = Workflow_syscall("CatglobeInABox_Payment_CheckMinAvailable", {companyResourceId, nrSending * 3400});
 +
if (!hasEnough) throw stringReplace(_("OutOfUnits"), "{0}", nrSending * 3.4);
 +
});
 
</source>
 
</source>

Revision as of 05:15, 25 November 2016


BulkMail_sendSyncronious

Send a bulk mail and return a number email have just sent.

Syntax

BulkMail_sendSyncronious(number BulkmailRId[,number MaxToSend][, callbackWithAmount]);

Arguments

BulkmailRId: Is a numeric (non-decimal) expression. It is the resource id of the bulk mail.
MaxToSend: Is a numeric (non-decimal) expression. It is the max email which send.
callbackWithAmount: any type

Return value

number

Examples

number a=BulkMail_sendSyncronious(15551353,1);
//result: 1
number sent = BulkMail_sendSyncronious(bm[BULKMAIL_RESOURCE_ID], limit, function(number nrSending) {
//3400 == n mails, plus n*3 questions
bool hasEnough = Workflow_syscall("CatglobeInABox_Payment_CheckMinAvailable", {companyResourceId, nrSending * 3400});
if (!hasEnough) throw stringReplace(_("OutOfUnits"), "{0}", nrSending * 3.4);
});