为了提高发送邮件的成功率,我们完全可以使用第三方服务来实现发送邮件功能,其中比较典型的提供商就是国外的mailgun和国内的sendcloud,由于sendcloud 模板限制为30条,且每次模板修改都要经过审核,故只能放弃使用sendcloud。
mailgun 绑定信用卡后,每月会赠送1万条邮件,对于小站来说基本够用,超出的部分也不贵。
有人可能会考虑sendcloud在国内的速度更快,mailgun在国外请求速度变慢,其实仔细一想,只要能收到国外的邮件,发送的速度慢点又何妨呢。
通过 mailgun api 发送邮件# include the autoloader (see libraries for install instructions)require 'vendor/autoload.php';use mailgun\mailgun;# instantiate the client.$mgclient = new mailgun('key-3ax6xnjp29jd6fds4gc373sgvjxteol0');$domain = samples.mailgun.org;# make the call to the client.$result = $mgclient->sendmessage($domain, array('from' => 'excited user ','to' => 'baz ','subject' => '邮件标题','text' => '邮件内容',));
这个api看起来很类似rest webservice api,简单而快捷。
(...)
read the rest of 使用 php mailgun 发送邮件 (105 words)
© li xi for lixiphp, 2014. |permalink |no comment |add todel.icio.us
post tags: api, mailgun, sendmail, smtp
feed enhanced by better feed from ozh