2011-12-15 5 views
5

Zendアプリケーションでsendgridを使用して電子メールを送信しようとしています。私はsendgridのドキュメント(smtapiクラスとswift)からphpコードをコピーします。Sendgridでセクションヘッダーを使用する

%variable%で置き換えられる場所でテンプレートを作成します。ここで定義されている今、私はsendgridのヘッダーを作成します。http://docs.sendgrid.com/documentation/api/smtp-api/developers-guide/

結果では、私はこのように見て何かを得る:すべてのデータは、私はセクションの作業を行うことができない「サブ」の変化で定義されながら、今

{ 
"to": ["[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"], 
"sub": {"%firstname%": ["Benny", "Chaim", "Ephraim", "Yehuda", "will"]}, 
"section": {"%postername%": "John Doe", "%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"} 
} 

を。最後のメールではまだ%postername%があります。私はこのデータをサブに移動し、各電子メールごとにそれらを繰り返すと、すべてうまくいきます。

誰かが私が間違っていることを知っていますか?セクションの

ドキュメントはここにある:http://docs.sendgrid.com/documentation/api/smtp-api/developers-guide/section-tags/

答えて

1

だけFYI、SendGridは最近、新しいPHPライブラリを発表しました。私は解決策を見つけた

1

を:あなたは(私は現在SendGridで働くと私のチームは、新しいライブラリを開発し、完全な開示)http://github.com/sendgrid/sendgrid-php

でそれを見つけることができます。セクションは置換後に使用され、どのサブが行うかを実行します。だから私が最初にすべての電子メールで%postname%を使用したいのであれば、そのサブが%postname%をコンテンツのどこかに置くようにする必要があります。

関連する問題