neoSmtp2GoSendHtml - Callback sub - Forum

Forum Navigation
You need to log in to create posts and topics.

neoSmtp2GoSendHtml - Callback sub

Hi..

I am using the neoSmtp2GoSendHtml to send a mail. The mail is been sent but i don't have any call back in my subroutine. I use:

If [IsMailSuccessfullSend] == "True"
AlertBox "Message" "Message is send" ""
endif

in subroutine to check the result.  Any demo or help instructions ?

 

@smartmedia I don't understand your question. You have two possible callback subroutines. The first one will execute on success and the second one on error.
In case of error you will get an error text message as a parameter.

Hi @luishp

The neoSmtp2GoSendHtml command is executed, the mail is been send but i don't receive response in success subroutine. This is my issue.

@smartmedia this is the complete JavaScript code used in neoSmtp2GoSendHTML:

function neoSmtp2GoSendHtml(theTo,theSender,theReplyTo,theSubject,htmlBody,successCallback,errorCallback){
        var url = "https://api.smtp2go.com/v3/email/send";
        if(theReplyTo==""){
          theReplyTo = theSender;
        }
 $.ajax({
   url: url,
   method: 'POST',
   headers: {
  'Content-Type': 'application/json'
   },
   data: JSON.stringify({
    		        "api_key": $App["neoSmtp2GoKey"],
   "to": [theTo],
   "sender": theSender,
   "subject": theSubject,
   "html_body": htmlBody,
   "custom_headers": [
     {
    "header": "Reply-To",
    "value": theReplyTo
     }
   ]
  }),
 }).done(function(result) {
           if(successCallback!=null){
       successCallback(result);
           }
 }).fail(function(err) {
           if(errorCallback!=null){
              errorCallback(err);
           }
 });
}

I got it from Smtp2Go API samples for JavaScript and it should call successCallback function once the email has been sent.

Regards.

 

susan has reacted to this post.
susan

Hi..

 

Just an update, finally i manged to got the response from the server of Smtp2Go.

So in neoSmtp2GoSendHtml command with an optional sub for success u must set a string parameter and then pass the contains into a new variable and check the data.succeeded to be 1 for success.

SetVar [IsMailSuccessfullSend] "[Parameters]"
If [IsMailSuccessfullSend.data.succeeded] == 1
alertbox "Message" "Message send successfully"
endif

 

 

 

luishp has reacted to this post.
luishp