如何在Windows Azure中使用PHP发送电子邮件?
发布时间:2020-12-13 20:17:53 所属栏目:Windows 来源:网络整理
导读:如何在 Windows Azure中使用 PHP发送电子邮件? 我使用简单的邮件功能: $to .= 'email-Id';$subject = " Test Subject";$headers = 'MIME-Version: 1.0' . "rn";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";$headers .= 'To: '.
如何在
Windows Azure中使用
PHP发送电子邮件?
我使用简单的邮件功能: $to .= 'email-Id'; $subject = " Test Subject"; $headers = 'MIME-Version: 1.0' . "rn"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn"; $headers .= 'To: '.$to.'' . "rn"; $headers .= 'From: '.$name. '<'.$email.'>' . "rn"; echo $message='email text here'; @mail($to,$subject,$message,$headers);
要使用PHP发送电子邮件,您有几个选择:
选项1:使用SMTP 您需要修改php.ini配置文件(http://php.net/manual/en/ref.mail.php),并将SMTP值设置为可以使用的外部SMTP服务器. SMTP服务器目前不是Windows Azure功能的一部分. [mail function] SMTP = mail.mycompany.com 选项二:使用sendmail 您需要修改php.ini配置文件(http://php.net/manual/en/ref.mail.php),并将sendmail_path值设置为sendmail可执行文件. [mail function] sendmail_path = "C:wampsendmailsendmail.exe -t" 由于sendmail在Windows中不存在,因此您需要使用假的sendmail for Windows:http://glob.com.au/sendmail/ 选项3:使用邮件/ smtp服务 您可以使用像SendGrid这样的服务发送您的电子邮件(他们有一个Azure用户的报价:http://sendgrid.com/azure.html).他们会照顾发送电子邮件,你只需要调用REST api: $sendgrid = new SendGrid('username','password'); $mail = new SendGridMail(); $mail->addTo('foo@bar.com')-> setFrom('me@bar.com')-> setSubject('Subject goes here')-> setText('Hello World!')-> setHtml('<strong>Hello World!</strong>'); $sendgrid->smtp->send($mail); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Windows 10 – Windows 10中的哪个程序使用端口80?
- winapi – 汇编程序:获取Win32的WinMain堆栈参数
- Windows – Win7 Virtualbox在尝试启动虚拟机时出现此错误:
- windows-server-2008 – “右键单击文件”会更新其上次访问
- windows-server-2008 – 我应该在Windows 2008 VM上禁用写缓
- WPF与Windows窗体
- EvoPDF库在Windows Azure托管站点上失败
- windows – 在服务器操作系统升级中跳过两个版本的坏主意?
- 组策略引擎在Windows上运行什么安全上下文?
- Windows命令行上的Unicode输出?
推荐文章
站长推荐
- windows – 如何设计/确保Web服务器的高可用性?
- windows-server-2008 – 如何在Windows 2008 R2中
- 如何在相同的Windows XP框上运行python 2.6和3.0
- windows – 使用Chocolatey创建自己的包
- wpf – Windows 8 XAML多列文本
- windows-server-2008 – 任何方式跳过WS2008的“
- 使用Ansible在Windows上执行.exe
- 使用ffmpeg截取视频第一帧当做背景图
- 使用cx_Freeze创建的Windows .exe返回0xc000007b
- windows – AutoHotKey可以切换键映射吗?
热点阅读