当我使用API发送电子邮件并告诉API这是模板时,另一端出现的只是模板的名称。
我正在使用官方的Mailgun SDK: https://github.com/mailgun/mailgun-php
这是我的代码:
$mailgunDomain = 'mailgun.example.com';
$emailaddress = 'foo@example.com';
$fullName = 'John Doe';
$url = 'https://www.example.com';
$response = $mg->messages()->send($mailgunDomain,[
'from' => 'example <test@example.com>','to' => $emailaddress,'subject' => 'Hello','template' => 'welcomemessage-2019-11-20.233057','text' => 'Testing some Mailgun awesomness!','h:X-Mailgun-Variables' => "{'URL': $url,'user': $fullName}"
]);
结果是-当我查看mailgun的登录信息时-welcomemessage-2019-11-20.233057 另外:电子邮件永远不会到达,最终以退回状态结束。
使用CURL时会发生预期的结果。然后,我收到HTML格式的电子邮件。
所以我想知道: 我的直觉说我做错了事。但是我不知道那是什么。期待收到任何指示。