cakephp 短信功能不起作用
$this->Email->to = '[email protected]';
$this->Email->subject = 'hi';
$this->Email->from = emailid;
$this->Email->template = null;
$this->Email->sendAs = 'text';
$text = "Device is down";
$this->Email->send($text);
使用上面的代码,如果我设置 $this->Email->sendAs = 'email';
,可以发送电子邮件,但它不适用于短信?
$this->Email->to = '[email protected]';
$this->Email->subject = 'hi';
$this->Email->from = emailid;
$this->Email->template = null;
$this->Email->sendAs = 'text';
$text = "Device is down";
$this->Email->send($text);
With Above code, if I set $this->Email->sendAs = 'email';
, email can be sent, but it is not working for SMS?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
EmailComponent 的 sendAs 属性控制发送电子邮件的格式。可以是“html”、“text”或“both”,这会将其作为带有纯文本后备的 HTML 电子邮件发送。
因此,我猜 Airtelmail 会捕获发送到
@airtelmail.com
的电子邮件,并通过短信将其发送到
。但是,这与 EmailComponent 无关 - EmailComponent 只能发送电子邮件。您可能想尝试使用 SMTP 服务器从您的应用程序发送邮件 - 一些提供商将 PHP 发送的电子邮件归类为垃圾邮件。有关详细信息,请参阅此处。
The sendAs property of the EmailComponent controls the format in which the e-mail is sent. That can be 'html', 'text' or 'both', which will send it as an HTML email with a plain text fallback.
So, I guess airtelmail will catch the emails sent to
<number>@airtelmail.com
and send them via SMS to<number>
. However, that has nothing to do with the EmailComponent - the EmailComponent can only send emails.You might wanna try to use a SMTP server for sending the mails out of your app - some providers classify emails sent by PHP as spam. See the here for details.