Using section header in Sendgrid

Posted by Zefiryn on Stack Overflow See other posts from Stack Overflow or by Zefiryn
Published on 2011-12-15T10:47:37Z Indexed on 2012/04/08 11:29 UTC
Read the original article Hit count: 549

Filed under:
|

I am trying to send emails through sendgrid in Zend application. I copy the php code from the sendgrid documentation (smtapi class and swift).

I create a template with places that should be substituted with %variable%. Now I create headers for sendgrid as defined here: http://docs.sendgrid.com/documentation/api/smtp-api/developers-guide/

In result I get something looking like this:

{
"to": ["[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"], 
"sub": {"%firstname%": ["Benny", "Chaim", "Ephraim", "Yehuda", "will"]}, 
"section": {"%postername%": "Rabbi Yitzchak Lieblich", "%postermail%": "[email protected]", "%categoryname%": "General", "%threadname%": "Completely new thread", "%post%": "This thread is to inform you about something very important", "%threadurl%": "http:\/\/hb.local\/forums\/general\/thread\/143", "%replyto%": "http:\/\/hb.local\/forums\/general\/thread\/143", "%unsubscribeurl%": "http:\/\/hb.local\/forums\/settings\/", "%subscribeurl%": "http:\/\/hb.local\/forums\/subscribe-thread\/id\/143\/token\/1b20eb7799829e22ba2d48ca0867d3ce"}
}

Now while all data defined in "sub" changes I cannot make section work. In the final email I still got %postername%. When I move this data to sub and repeat them for each email everything is working fine.

Has anyone a clue what I am doing wrong?

Docs for section are here: http://docs.sendgrid.com/documentation/api/smtp-api/developers-guide/section-tags/

© Stack Overflow or respective owner

Related posts about php

Related posts about sendgrid