chris
indifferent I’m undecided

Bug in HTTP API with multiple "to" and "toname" parameters

I am experiencing a bug with the recipients of an e-mail being sent with the HTTP API. The association between the "to" and "toname" parameters is being swapped when I give a query string like this:

to%5B0%5D=chrisw%40row27.com&to%5B1%5D=erik%40row27.com&toname%5B0%5D=chrisw%40row27.com&toname%5B1%5D=erik%40row27.com

The ordering in the query string appears to be correct, but then you look at the e-mail:

To: "erik@row27.com" , "chrisw@row27.com"

The association is wrong.

I believe I am using the API correctly according to http://docs.sendgrid.com/documentatio...
2 people have
this problem
+1
Reply

  • Jacob (Support Engineer) January 12, 2012 15:05
    Can you give me the full string you're using?

    I can also convert this into a ticket if you'd like.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • chris
    You could turn this into a ticket if you think it would be beneficial to your company. I am just submitting this bug report to ensure we are not doing anything wrong on our end.

    This string was built in PHP from the data structure below using the http_build_query function:


    string(954) "to%5B0%5D=chrisw%40row27.com&to%5B1%5D=erik%40row27.com&toname%5B0%5D=chrisw%40row27.com&toname%5B1%5D=erik%40row27.com&from=noreply%40row27.com&text=Help+Us+Grow%0AA+submission+was+received+on+the+UCF+Golden+Knights+Club+website.+The%0Afollowing+contact+details+were+submitted+on+behalf+of+a+potential+new+member%0Aof+the+Golden+Knights+Club.%0AFull+Name%3A+John+Doe%0APhone%3A+%28860%29+555-5555%0AE-mail%3A+test%40example.com%0A&subject=UCF+Help+Us+Grow+Submission&fromname=UCF+Golden+Knights+Club+Website&replyto=noreply%40row27.com&html=%3Ch1%3EHelp+Us+Grow%3C%2Fh1%3E%0A%3Cp%3EA+submission+was+received+on+the+UCF+Golden+Knights+Club+website.+The%0Afollowing+contact+details+were+submitted+on+behalf+of+a+potential+new+member%0Aof+the+Golden+Knights+Club.%3C%2Fp%3E%0A%3Cp%3EFull+Name%3A+John+Doe%3C%2Fp%3E%0A%3Cp%3EPhone%3A+%28860%29+555-5555%3C%2Fp%3E%0A%3Cp%3EE-mail%3A+test%40example.com%3C%2Fp%3E%0A&api_user=xxx&api_key=xxx"



    array(10) {
    ["to"]=>
    array(2) {
    [0]=>
    string(16) "chrisw@row27.com"
    [1]=>
    string(14) "erik@row27.com"
    }
    ["toname"]=>
    array(2) {
    [0]=>
    string(16) "chrisw@row27.com"
    [1]=>
    string(14) "erik@row27.com"
    }
    ["from"]=>
    string(17) "noreply@row27.com"
    ["text"]=>
    string(255) "Help Us Grow
    A submission was received on the UCF Golden Knights Club website. The
    following contact details were submitted on behalf of a potential new member
    of the Golden Knights Club.
    Full Name: John Doe
    Phone: (860) 555-5555
    E-mail: test@example.com
    "
    ["subject"]=>
    string(27) "UCF Help Us Grow Submission"
    ["fromname"]=>
    string(31) "UCF Golden Knights Club Website"
    ["replyto"]=>
    string(17) "noreply@row27.com"
    ["html"]=>
    string(292) "<h1>Help Us Grow</h1>
    <p>A submission was received on the UCF Golden Knights Club website. The
    following contact details were submitted on behalf of a potential new member
    of the Golden Knights Club.</p>
    <p>Full Name: John Doe</p>
    <p>Phone: (860) 555-5555</p>
    <p>E-mail: test@example.com</p>
    "
    ["api_user"]=>
    string(16) "xxx"
    ["api_key"]=>
    string(7) "xxx"
    }



    Here is the e-mail source:



    Delivered-To: chrisw@row27.com
    Received: by 10.231.30.205 with SMTP id v13cs21634ibc;
    Thu, 12 Jan 2012 07:37:28 -0800 (PST)
    Received: by 10.52.155.176 with SMTP id vx16mr2004505vdb.3.1326382647092;
    Thu, 12 Jan 2012 07:37:27 -0800 (PST)
    Return-Path: <bounces+22601-476d-chrisw=row27.com@sendgrid.me>
    Received: from o1.sendgrid.net (o1.sendgrid.net. [174.36.80.216])
    by mx.google.com with SMTP id f67si5759256yhk.131.2012.01.12.07.37.26;
    Thu, 12 Jan 2012 07:37:26 -0800 (PST)
    Received-SPF: pass (google.com: domain of bounces+22601-476d-chrisw=row27.com@sendgrid.me designates 174.36.80.216 as permitted sender) client-ip=174.36.80.216;
    Authentication-Results: mx.google.com; spf=pass (google.com: domain of bounces+22601-476d-chrisw=row27.com@sendgrid.me designates 174.36.80.216 as permitted sender) smtp.mail=bounces+22601-476d-chrisw=row27.com@sendgrid.me; dkim=pass header.i=@sendgrid.me
    DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=
    content-type:mime-version:from:to:reply-to:subject:message-id
    :date:sender; s=smtpapi; bh=ohfswODw+qrdk1BmbQsGmZUvnFc=; b=y4RD
    ysRAPi30gzFlzkhm2oWyuiLYqCd0e+8ffithoUJhgNbxagNlPbztKv/YcN147aSP
    Td6qG4A3mgCJgD033V3K5W0CSxeYs8e+vuKyPbcfXNgDQ5/RyQq7td1HVi10I+4Q
    OtP4swgQc1O9sbiie4Pc71QI6kkUpuNf2H1QkFo=
    DomainKey-Signature: a=rsa-sha1; c=nofws; d=sendgrid.me; h=content-type
    :mime-version:from:to:reply-to:subject:message-id:date:sender;
    q=dns; s=smtpapi; b=OyXUqrL5OagPa1LWh/2jrDIrM8j2LaXqI/YoP/yNk1v
    BHrvuu/LY+Cauj8UHAn7CFoEguZDQbXKMg1JJ7Y9YE2ht/bv0iHHvEASHvNoJs9c
    56Uytqw9j8hDHKSXHWBjx9BsqM/wgCpIGM+aNrTG9rXiXwoWduZYXEFeSgQoiDkE
    =
    Received: by 10.4.35.204 with SMTP id mf47.23507.4F0EFE365
    Thu, 12 Jan 2012 09:37:26 -0600 (CST)
    Received: from 127.0.0.1 (unknown [mi7])
    by mi7.sendgrid.net (SG) with ESMTP id 4f0efe36.38b3.1e5ea56
    Thu, 12 Jan 2012 09:37:26 -0600 (CST)
    Content-Type: multipart/alternative;
    boundary="===============4587309272929798593=="
    MIME-Version: 1.0
    From: UCF Golden Knights Club Website <noreply@row27.com>
    To: "erik@row27.com" <chrisw@row27.com>, "chrisw@row27.com" <erik@row27.com>
    Reply-To: noreply@row27.com
    Subject: UCF Help Us Grow Submission
    Message-ID: <1326382646.2419745325335814@mf47.sendgrid.net>
    Date: Thu, 12 Jan 2012 09:37:26 -0600 (CST)
    X-Sendgrid-EID: wn8wpbIibOFxQVA3qUQ9g5LWp6qfa1ZnMJ8uNdMbGlpFZXEJOjDdUjVqvqrgL+TawzC2a3RXzJVVmZY7BNoWAPjtpsb/bytWmcSn4zpLoo9NEl4M7j1LqnZX4c3K+SyF3jmapSB5sinbDigYFVYe/w==
    Sender: UCF Golden Knights Club Website <noreply=row27.com@sendgrid.me>
    X-SendGrid-Contentd-ID: {"test_id":1326382646}

    --===============4587309272929798593==
    Content-Type: text/plain; charset="utf-8"
    MIME-Version: 1.0
    Content-Transfer-Encoding: quoted-printable

    Help Us Grow
    A submission was received on the UCF Golden Knights Club website. The
    following contact details were submitted on behalf of a potential new member
    of the Golden Knights Club.
    Full Name: John Doe
    Phone: (860) 555-5555
    E-mail: test@example.com

    --===============4587309272929798593==
    Content-Type: text/html; charset="utf-8"
    MIME-Version: 1.0
    Content-Transfer-Encoding: quoted-printable

    <h1>Help Us Grow</h1>
    <p>A submission was received on the UCF Golden Knights Club website. The
    following contact details were submitted on behalf of a potential new member
    of the Golden Knights Club.</p>
    <p>Full Name: John Doe</p>
    <p>Phone: (860) 555-5555</p>
    <p>E-mail: test@example.com</p>

    --===============4587309272929798593==--

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • phil
    sad I’m concerned
    This is what's happening for me also. As soon as I read the documentation I knew this would be a problem area.

    Has anything happened in the last 3 months to rectify this? or is there something that OP was doing wrong?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • Jacob (Support Engineer) April 09, 2012 20:13
    Ah, I totally missed this on my first response:

    Your call is missing 2 things from the documentation:
    You need to define that it's an array by using the "to[]" and "toname[]" variants, and
    you need to pair the to & toname, not a list of to's followed by a list of tonames, like so:

    # curl -d 'to[]=destination@example.com&toname[]=Destination&to[]=destination2@example.com&toname[]=Destination2&subject=Example Subject&text=testingtextbody&from=info@domain.com&api_user=sendgridUsername&api_key=sendgridPassword' https://sendgrid.com/api/mail.send.json
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited