如何使用PHP发送邮件? [英] How to send mail using PHP?

查看:123
本文介绍了如何使用PHP发送邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows Vista操作系统。
PHP,MySQL作为数据库和Apache Web服务器。



我想向想要加入我的网站的用户发送通知。
但问题是当我点击提交。它不会向用户的电子邮件地址发送任何内容。



您认为最好的解决方案是什么?

 <?php 
$ to =recipient@example.com;
$ subject =嗨!;
$ body =你好,\\\
\\\
你好吗?
if(mail($ to,$ subject,$ body)){
echo(< p> Message successfully sent!< / p>);
} else {
echo(< p>消息传递失败...< / p>);
}
?>


解决方案

Zend_Mail Zend Framework 做一个非常整洁的工作,发送电子邮件!您不需要使用整个Zend Framework,您只需使用Zend_Mail!


I'm using Windows Vista OS. PHP, MySQL as the database and Apache web server.

I want to send notification to those who want to join in my site. But the problem is when I click submit. It doesn't send anything to the email address of the user.

What to do you think is the best solution for this?

<?php
$to = "recipient@example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
  echo("<p>Message successfully sent!</p>");
 } else {
  echo("<p>Message delivery failed...</p>");
 }
?>

解决方案

Zend_Mail of the Zend Framework does a very neat job with sending E-Mails!! You don't need to use the whole of Zend Framework, you can just use Zend_Mail!

这篇关于如何使用PHP发送邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆