Pamba
Pamba

Reputation: 822

How to send mail to admin email in Google Apps PHP runtime

I am using google apps engine for a php project and its working fine. But i have a doubt in Mail API. As per GAE documentaion (https://cloud.google.com/appengine/docs/quotas?csw=1#Mail) i have read the quotas limit ie. The quota limit of mail sending in google apps is

'Recipients Emailed' 100/Day 
'Admins Emailed'    5,000/Day

Now i am using the below method for sending mail

use \google\appengine\api\mail\Message;

$image_content_id = '<image-content-id>';

try
{
  $message = new Message();
  $message->setSender("[email protected]");
  $message->addTo("[email protected]");
  $message->setSubject("Example email");
  $message->setTextBody("Hello, world!");
  $message->addAttachment('image.jpg', 'image data', $image_content_id);
  $message->send();
} catch (InvalidArgumentException $e) {
  // ...
}

This working fine. I am using this method for sending mail to admin email address. Mail successfully send. But the 'Admins Emailed' quota count is not incrementing, 'Recipients Emailed' is incrementing

How can i send mail to admin email in PHP runtime?

Is it possible?

Thanks

Upvotes: 2

Views: 183

Answers (1)

Mars
Mars

Reputation: 1422

You'll need to use google\appengine\api\mail\AdminMessage and new AdminMessage() instead to have it count against the admin email quota.

Upvotes: 1

Related Questions