5

Zend アプリケーションで sendgrid を介してメールを送信しようとしています。sendgrid ドキュメント (smtapi クラスと迅速) から php コードをコピーします。

%variable% に置き換える必要がある場所を含むテンプレートを作成します。ここで定義されているように、sendgrid のヘッダーを作成します: http://docs.sendgrid.com/documentation/api/smtp-api/developers-guide/

その結果、次のようなものが得られます。

{
"to": ["mail1@domain.com", "mail2@domain.com", "mail3@domain.com", "mail4@domain.com", "sfwwnkff@sharklasers.com"], 
"sub": {"%firstname%": ["Benny", "Chaim", "Ephraim", "Yehuda", "will"]}, 
"section": {"%postername%": "John Doe", "%postermail%": "james@doe.com", "%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/

4

2 に答える 2

1

参考までに、SendGrid は最近、新しい PHP ライブラリを公開しました。http://github.com/sendgrid/sendgrid-phpで見つけることができます

(完全な開示: 私は現在 SendGrid で働いており、私のチームは新しいライブラリを開発しました)

于 2012-03-27T03:37:57.673 に答える
1

解決策を見つけました。セクションは置換後に使用され、サブが行うことを実行します。したがって、最初にすべてのメールで %postname% を使用したい場合は、sub がコンテンツのどこかに %postname% を配置するようにする必要があります。

于 2012-09-27T23:49:52.350 に答える