what is the proper format to send an array in a request parameter.. sorry im new at this but love it so far...
what is the proper format to send an array in a request parameter.. sorry im new at this but love it so far...
Hi Casey -
Can you show what exactly you have tried to send?
trying to send multiple emails in the "to" request field of the sendgrid plugin
from the doc on SendGrid "to[]=a href="mailto:a@mail.com" rel="nofollow"a@mail.com/a&to[]=a href="mailto:b@mail.com" rel="nofollow"b@mail.com/a"
in testing the service I send something like this::
[{"to":"a href="mailto:email1@aol.com" rel="nofollow"email1@aol.com/a"}, {"to":a href="mailto:email2@aol.com" rel="nofollow"email2@aol.com/a}]
Hello Casey,
We need additional time to look into this. Sorry for delay. We'll update asap.
Hi Casey.
Unfortunately there is no available multiple addresses in this plugin by default.
But if you want to do it you can try next steps:
1 open Services-SendGrid_MailSend.
2 Request. Delete "to" parameter.
3 Invoke service only via javascript code:
pre
sendgrid_mailsend.execute({data: {"to[]": ["yourfirstEmail@sss.com", "yoursecondEmail@sss.com"]} });
/pre
It will generate request with multiple to[] parameters. Please check it after in "net" tab of the browser debugger.
Igor-
Two questions:
For your #3, instead of having my button's click action be set to "Invoke Service", I would have the click action be "Run Javascript" with the code above?
Is it possible to use this javascript to have variable email addresses?
Am I able to do something like this?
var email1 = localStorage.getItem('clientEmail1');
var email2 = localStorage.getItem('clientEmail2');
var email3 = localStorage.getItem('clientEmail3');
sendgrid_mailsend.execute({data: {"to[]": [email1, email2, email3]} });
Thanks for your help.
Cheers,
Nathan
Hello -
Thanks for the fast response. So this is the code I wrote. It will send to the first email address but not the other three. I made an alert to make sure that the local storage variables had values. I checked the spam and junk folders on the other three accounts and nothing came through. But it will come through to the first email. What am I doing wrong?
My code:
var email1 = localStorage.getItem('clientEmail');
var email2 = localStorage.getItem('clientEmailTwo');
var email3 = localStorage.getItem('clientEmailThree');
var email4 = localStorage.getItem('clientEmailFour');
//alert(email2 + " " + email3 + " " + email4);
sendgrid_mailsend.execute({data: {"to[]": [email1, email2, email3, email4]} });
Thanks for the fast response. So this is the code I wrote. It will send to the first email address but not the other three. I made an alert to make sure that the local storage variables had values. I checked the spam and junk folders on the other three accounts and nothing came through. But it will come through to the first email. What am I doing wrong?
My code:
var email1 = localStorage.getItem('clientEmail');
var email2 = localStorage.getItem('clientEmailTwo');
var email3 = localStorage.getItem('clientEmailThree');
var email4 = localStorage.getItem('clientEmailFour');
//alert(email2 + " " + email3 + " " + email4);
sendgrid_mailsend.execute({data: {"to[]": [email1, email2, email3, email4]} });
I have to say I never was able to get this to work for me.. I ended up switching to Mandrill. I still use SendGrid for a backup email. With Mandrill I I was able to send email to multiple recipients and also create an HTML template and then send merge tags to replace the placeholders in the template before sending.