casey palmer
Posts: 0
Joined: Tue Mar 18, 2014 6:32 am

email array to sendgrid

what is the proper format to send an array in a request parameter.. sorry im new at this but love it so far...

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

email array to sendgrid

Hi Casey -

Can you show what exactly you have tried to send?

casey palmer
Posts: 0
Joined: Tue Mar 18, 2014 6:32 am

email array to sendgrid

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}]

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

email array to sendgrid

Hello Casey,

We need additional time to look into this. Sorry for delay. We'll update asap.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

email array to sendgrid

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.

Nathan Morin
Posts: 0
Joined: Thu Sep 05, 2013 6:12 am

email array to sendgrid

Igor-

Two questions:

  1. 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?

  2. 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

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

email array to sendgrid

Hello -

  1. Yes, you should set action "Run JavaScript" on click event with above code.
  2. You can use local storage variable to store the email and use the values ​​in the code.
Nathan Morin
Posts: 0
Joined: Thu Sep 05, 2013 6:12 am

email array to sendgrid

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]} });

Nathan Morin
Posts: 0
Joined: Thu Sep 05, 2013 6:12 am

email array to sendgrid

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]} });

casey palmer
Posts: 0
Joined: Tue Mar 18, 2014 6:32 am

email array to sendgrid

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.

Return to “Issues”