我按照Google指南尝试在GAE GAE guide上发送来自PHP的电子邮件,但我收到了错误消息:
消息收到无效选项:正文
以下是代码:
require_once 'google/appengine/api/mail/Message.php';
use google\appengine\api\mail\Message;
// ...
$message_body = "...";
$mail_options = [
"sender" => "admin@example.com",
"to" => "user@example.com",
"subject" => "Your example.com account has been activated.",
"body" => $message_body
];
try {
$message = new Message($mail_options);
$message->send();
} catch (\InvalidArgumentException $e) {
// ...
}
答案 0 :(得分:2)
我认为您需要指定textBody
或htmlBody
,具体取决于您发送的邮件的格式。
$mail_options = [
"sender" => "admin@example.com",
"to" => "user@example.com",
"subject" => "Your example.com account has been activated.",
"textBody" => $message_body
];