【发布时间】:2016-01-30 07:31:18
【问题描述】:
我正在尝试使用 php 中的 postmarkapp api 发送电子邮件,我已经设法让它发送普通电子邮件。我已将该类上传到与 index.php 相同的目录,但“使用”功能似乎给了我一个我不知道的错误。
错误:
Parse error: syntax error, unexpected '.', expecting identifier (T_STRING) in /public_html/index.php on line 5
Index.php
// Import the Postmark Client Class.
use Postmark\Models\PostmarkAttachment;
use Postmark\PostmarkClient\.php;
// Create Client
$client = new PostmarkClient("MY API KEY - CENSORED");
// Make a request
$sendResult = $client->sendEmailWithTemplate(
"sender@example.com",
"recipient@example.com",
TEMPLATEID-CENSORED,
[
"product_name" => "product_name_Value",
"name" => "name_Value",
"action_url" => "action_url_Value",
"username" => "username_Value",
"sender_name" => "sender_name_Value",
"product_address_line1" => "product_address_line1_Value",
"product_address_line2" => "product_address_line2_Value",
]);
同目录Postmark/我有这个班(官方班)
https://github.com/wildbit/postmark-php/tree/master/src/Postmark
感谢您花时间阅读,非常感谢。
【问题讨论】:
-
显然我已经审查了我的模板 ID 和 API 密钥。
-
我必须在命令行中运行 composer require wildbit/postmark-php 吗?