Reputation: 53
I'm follow the Google guide try send an email from PHP on GAE GAE guide, but I got an error:
Message received an invalid option: body
Below is the code:
require_once 'google/appengine/api/mail/Message.php';
use google\appengine\api\mail\Message;
// ...
$message_body = "...";
$mail_options = [
"sender" => "[email protected]",
"to" => "[email protected]",
"subject" => "Your example.com account has been activated.",
"body" => $message_body
];
try {
$message = new Message($mail_options);
$message->send();
} catch (\InvalidArgumentException $e) {
// ...
}
Upvotes: 0
Views: 1468
Reputation: 7054
I believe you need to either specify textBody
or htmlBody
, depending on the format of the message you're sending.
$mail_options = [
"sender" => "[email protected]",
"to" => "[email protected]",
"subject" => "Your example.com account has been activated.",
"textBody" => $message_body
];
Upvotes: 2