I correct what I wrote earlier… The problem seems to be in the "
sendMessage". If I delete this function, the other functions seem to work.
…
var result = "";
var files = {};
var postVars = {
from = arguments.from
, to = arguments.to
, subject = arguments.subject
, text = arguments.text
, html = arguments.html
};
if ( Len( Trim( arguments.cc ) ) ) {
postVars.cc = arguments.cc;
}
if ( Len( Trim( arguments.bcc ) ) ) {
postVars.bcc = arguments.bcc;
}
if ( _getForceTestMode() or arguments.testMode ) {
postVars[ “o:testmode” ] = “yes”;
}
if ( ArrayLen( arguments.tags ) ) {
postVars[ “o:tag” ] = arguments.tags;
}
if ( Len( Trim( arguments.campaign ) ) ) {
postVars[ “o:campaign” ] = arguments.campaign;
}
if ( IsBoolean( arguments.dkim ) ) {
postVars[ “o:dkim” ] = _boolFormat( arguments.dkim );
}
if ( IsDate( arguments.deliveryTime ) ) {
postVars[ “o:deliverytime” ] = _dateFormat( arguments.deliveryTime );
}
if ( IsBoolean( arguments.tracking ) ) {
postVars[ “o:tracking” ] = _boolFormat( arguments.tracking );
}
if ( IsBoolean( arguments.clickTracking ) ) {
postVars[ “o:tracking-clicks” ] = _boolFormat( arguments.clickTracking );
} elseif( arguments.clickTracking eq “htmlonly” ) {
postVars[ “o:tracking-clicks” ] = “htmlonly”;
}
if ( IsBoolean( arguments.openTracking ) ) {
postVars[ “o:tracking-opens” ] = _boolFormat( arguments.openTracking );
}
for( var key in arguments.customHeaders ){
postVars[ “h:X-#key#” ] = arguments.customHeaders[ key ];
}
for( var key in arguments.customVariables ){
postVars[ “v:#key#” ] = arguments.customVariables[ key ];
}
if ( ArrayLen( arguments.attachments ) ) {
files.attachment = arguments.attachments;
}
if ( ArrayLen( arguments.inlineAttachments ) ) {
files.inline = arguments.inlineAttachments;
}
result = _restCall(
httpMethod = “POST”
, uri = “/messages”
, domain = arguments.domain
, postVars = postVars
, files = files
);
if ( StructKeyExists( result, “id” ) ) {
return result.id;
}
_throw(
type = “unexpected”
, message = “Unexpected error processing mail send. Expected an ID of
successfully sent mail but instead received [#SerializeJson( result )#]”
);
Why do you think it does not work?