Stampie 是简单的 API 包装,为不同 Email (例如Postmark、SendGrid)提供 API 。它易于使用,并且能整合进你的应用程序中。
示例代码:
<?php // Stampie.phar does Autoloading through its Stup.php require '/path/to/stampie.phar'; class Message extends \Stampie\Message { public function getFrom() { return 'alias@domain.tld'; } public function getSubject() { return 'You are trying out Stampie'; } public function getText() { return 'So what do you think about it?'; } } $adapter = new Stampie\Adapter\Buzz(new Buzz\Browser()); $mailer = new Stampie\Mailer\SendGrid($adapter, 'username:password'); // Returns Boolean true on success or throws an HttpException for error // messages not recognized by SendGrid api or ApiException for known errors. $mailer->send(new Message('reciever@domain.tld'));