2011-12-15 2 views
5

젠드 응용 프로그램에서 sendgrid를 통해 전자 메일을 보내려고합니다. 나는 sendgrid 문서 (smtapi 클래스와 swift)에서 php 코드를 복사한다.Sendgrid에서 섹션 헤더 사용

% variable %로 대체해야하는 작업 영역이있는 템플릿을 만듭니다. 결과에서 http://docs.sendgrid.com/documentation/api/smtp-api/developers-guide/

는 뭔가 같은보고를 얻을 : 여기에 정의 된 바와 같이 지금은 sendgrid에 대한 헤더를 만들

{ 
"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

그냥 참고로, SendGrid는 최근에 새로운 PHP 라이브러리를 발표했다. 당신은 http://github.com/sendgrid/sendgrid-php

에서 찾을 수 있습니다 (전체 공개 : 저는 현재 SendGrid에서 일을하고 우리 팀은 새로운 라이브러리 개발) 나는 해결책을 발견

1

합니다. 섹션은 대체 후 사용되며 하위가 수행하는 작업을 수행합니다. 따라서 모든 이메일에서 % postname %을 사용하려면 하위에 % postname %을 콘텐츠의 어딘가에 배치해야합니다.

관련 문제