【问题标题】:Postmarkapp sending email using template PHP classPostmarkapp 使用模板 PHP 类发送电子邮件
【发布时间】: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 吗?

标签: php api email postmark


【解决方案1】:

我认为您需要“使用 Postmark\PostmarkClient;”而不是“使用 Postmark\PostmarkClient.php;”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-22
    • 2011-04-12
    • 2018-07-11
    • 2020-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-17
    相关资源
    最近更新 更多