{"action":"created","issue":{"url":"https://api.github.com/repos/sendgrid/sendgrid-php/issues/228","repository_url":"https://api.github.com/repos/sendgrid/sendgrid-php","labels_url":"https://api.github.com/repos/sendgrid/sendgrid-php/issues/228/labels{/name}","comments_url":"https://api.github.com/repos/sendgrid/sendgrid-php/issues/228/comments","events_url":"https://api.github.com/repos/sendgrid/sendgrid-php/issues/228/events","html_url":"https://github.com/sendgrid/sendgrid-php/issues/228","id":149419036,"number":228,"title":"Substitution not working with setTos and setSmtpapiTos","user":{"login":"kumarbalap","id":9416267,"avatar_url":"https://avatars.githubusercontent.com/u/9416267?v=3","gravatar_id":"","url":"https://api.github.com/users/kumarbalap","html_url":"https://github.com/kumarbalap","followers_url":"https://api.github.com/users/kumarbalap/followers","following_url":"https://api.github.com/users/kumarbalap/following{/other_user}","gists_url":"https://api.github.com/users/kumarbalap/gists{/gist_id}","starred_url":"https://api.github.com/users/kumarbalap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumarbalap/subscriptions","organizations_url":"https://api.github.com/users/kumarbalap/orgs","repos_url":"https://api.github.com/users/kumarbalap/repos","events_url":"https://api.github.com/users/kumarbalap/events{/privacy}","received_events_url":"https://api.github.com/users/kumarbalap/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-19T10:37:36Z","updated_at":"2016-04-26T09:16:47Z","closed_at":null,"body":"Hi,\r\n\r\nI have a template with substitutions. (example: **#product_name#**).\r\n\r\nWhen I send to individual person, the substitutions working fine, but not with array of mail ids.\r\nI have tested with both setTos and setSmtpapiTos.\r\n\r\nHere is my code.\r\n```\r\n\r\nif ( is_array($to) ) {\r\n\t$email->setTos( $to );\r\n\t//$email->setSmtpapiTos( $to );\r\n} else {\r\n\t$email->addTo( $to );\r\n}\r\n\r\n$email\r\n\t->setFrom('donotreply@test.com')\r\n\t->setFromName('Test From')\r\n\t->setSubject(' ')\r\n\t->setHtml(' ')\r\n\t->setText(' ')\r\n\t->setTemplateId($templateId);\r\n\r\nif ( count($mailData) != 0 ) {\r\n\tforeach ( $mailData as $dataKey => $dataVal ) {\r\n\t\t$name = '#' .$dataKey. '#';\r\n\t\t$email->addSubstitution( $name, array( $dataVal ) );\r\n\t}\r\n}\r\n\r\nif ( count($categories) != 0 ) {\r\n\t$email->setCategories( $categories );\r\n}\r\n\r\ntry {\r\n\t$sendgrid->send($email);\r\n} catch(\\SendGrid\\Exception $e) {\r\n\tLog::error( 'Mail not sent. Template: ' . $template . $e->getCode() );\r\n}\r\n```\r\nPlease don't look at the variables, its all working fine. I have tested many times with single email id.\r\n\r\nThanks,\r\nBala"},"comment":{"url":"https://api.github.com/repos/sendgrid/sendgrid-php/issues/comments/214679894","html_url":"https://github.com/sendgrid/sendgrid-php/issues/228#issuecomment-214679894","issue_url":"https://api.github.com/repos/sendgrid/sendgrid-php/issues/228","id":214679894,"user":{"login":"kumarbalap","id":9416267,"avatar_url":"https://avatars.githubusercontent.com/u/9416267?v=3","gravatar_id":"","url":"https://api.github.com/users/kumarbalap","html_url":"https://github.com/kumarbalap","followers_url":"https://api.github.com/users/kumarbalap/followers","following_url":"https://api.github.com/users/kumarbalap/following{/other_user}","gists_url":"https://api.github.com/users/kumarbalap/gists{/gist_id}","starred_url":"https://api.github.com/users/kumarbalap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumarbalap/subscriptions","organizations_url":"https://api.github.com/users/kumarbalap/orgs","repos_url":"https://api.github.com/users/kumarbalap/repos","events_url":"https://api.github.com/users/kumarbalap/events{/privacy}","received_events_url":"https://api.github.com/users/kumarbalap/received_events","type":"User","site_admin":false},"created_at":"2016-04-26T09:16:47Z","updated_at":"2016-04-26T09:16:47Z","body":"Hi @thinkingserious \r\n\r\nI have opened a support ticket for the same, so far no reply.\r\n[https://community.sendgrid.com/sendgrid/topics/substitution-not-working-with-settos-and-setsmtpapitos](https://community.sendgrid.com/sendgrid/topics/substitution-not-working-with-settos-and-setsmtpapitos)\r\n\r\nCan you please help me on this, I'm evaluating for one of my application. \r\n\r\nThanks,\r\nBala"}}