⑴ linux phpMailer 发送邮件sendmail 发邮件失败问题
1、用的腾讯云服务器,折腾了很多资料,发现改错了。谨记检查端口25开放
2、TP框架用PHPMailer 发送邮件,windows本地测试正常,上传到腾讯云linux服务器就发送不成功:
细节如下: [root@VM_82_192_centos ~]# tail -40 /var/log/maillog
把class.phpmailer.php中的$this->mailer = smtp;中的smtp换成大写:SMTP。说是因为qq 163等邮箱需要接受发送过来的大写的SMTP;
发现还是不成功
反过头来检查25端口:
发现没反应:yum重装sendmail,还是同样。直接杀到云服务器哪儿,检查25端口是否开放;泪流满面:赶紧解封。
确认:
OK,测试发送 mail -s '33333333555ksTest mail' [email protected] < /etc/passwd
⑵ 怎么在Windows系统中安装sendmail并且使用PHP mail函数
php mail()函数windows能用需要安装sendmail
1.载sendmail.zip
2.解压C:例C:\PHP\sendmail短路径路径名能产问题
3.修改php.ini
sendmail_path = "C:\PHP\sendmail\sendmail.exe -t"
4.根据自配置环境修改掘陪塌sendmail.ini
第启用debug.log_file,error_logfile查看sendmail否效
5.重启apache
用sendmail结合其smtp服务器smtp.gmail.com实现发邮件现部邮箱都要求smtp验证所要sendmail.ini加入用乱陆户名密码
php.ini配置 (用gmail邮箱例)
[mail function]
; For Win32 only.
SMTP = smtp.gmail.com
smtp_port = 25
; For Win32 only.
sendmail_from = [email protected]
; For Unix only. You may supply arguments as well (default: sendmail -t -i).
sendmail_path = C:\PHP\sendmail\sendmail.exe -t
配置三项smtp、smtp_portsendmail_path
sendmail.ini配置判圆
[sendmail]
; you must change mail.mydomain.com to your smtp server
smtp_server=smtp.gmail.com
smtp_port=25
auth_username=yourusername
auth_password=yourpassword
[email protected]
; default_domain=mydomain.com
sendmail网用xampp面直接带
同虚拟主机httpd.conf加句
⑶ discuz 2.0 通过 PHP 函数的 sendmail 发送(推荐此方式) 详细配置
如果用ESMTP发邮件的,要配液绝置好smtp服务器的地址如 smtp.qq.com ,还有端口 25 默认就行,发送者邮箱如 [email protected], 发送者用户名和密码 [email protected],xxxxxx ;
如果你是桥埋斗用PHP自带的mail函数的话,如果在Linux下需要配置好sendmail服务,如果是在Windows下,就去php.ini文件,配置好SMTP相关的参数
SMTP = localhost
smtp_port = 25
再不懂的话HI我把,敏磨或者QQ我 28605045
⑷ 怎么利用php发送邮件求详细教程
PHP虽然提供了mail()函数,但并不好用,而PHPMailer是一个不错的邮件发送工具,接下来将详细介绍,需要了解的朋友可以参考下:
本人使用wamp集成开发环境,Apache2.4.4, Mysql5.6.12 , php5.4.12.开始的时候使用mail()发送邮件,更改配置始终无法成功,了解到mail()函数使用需要sendmail程序。又下载了sendmail程序扩展包。按照网上的说法也改好了php.ini和sendmail.ini。使用foxmail 7.1创建了自己的qq邮箱账户,开启了POP3/SMTP服务,更改发件服务器为POP3,使用和收件服务器相同的身份验证,结果还是报错:Warning: mail(): SMTP server response: 503 Error: need EHLO and AUTH first ! in F:\PHP\wamp\www\mail.php on line 8。以下是使用mail()函数发送邮件的php代码:
[php] view plain
<span style="font-size:14px"><?php
$to = "[email protected]";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "[email protected]";
$headers = "From: $from";
$send=mail($to,$subject,$message,$headers);
if($send)
echo "Mail Sent";
else
echo "Sorry,mail sent failed!"
?></span>
在CSDN论坛上发现phpmailer可以方便快捷的发送邮件,以下写出详细使用教程:
1.需要下载PHPMailer文件包,(点击打开链接)
2.确认你的服务器已经系统支持socket,通过phpinfo()查看是否支持socket;
3.把文件解压到你的WEB服务器目录下,就可以使用PHPMailer发送邮件了。
以下为前台表单php代码:
[php] view plain
<span style="font-size:14px"><html>
<body>
<h3>phpmailer Unit Test</h3>
请你输入<font color="#FF6666">收信</font>的邮箱地址:
<form name="phpmailer" action="testemail.php" method="post">
<input type="hidden" name="submitted" value="1"/>
邮箱地址: <input type="text" size="50" name="to" />
<br/>
<input type="submit" value="发送"/>
</form>
</body>
</html> </span>
以下为后台程序:
[php] view plain
<?php
/**
* Simple example script using PHPMailer with exceptions enabled
* @package phpmailer
* @version $Id$
*/
header("content-type:text/html;charset=utf-8");
ini_set("magic_quotes_runtime",0);
require('class.phpmailer.php');
try {
$mail = new PHPMailer(true); //New instance, with exceptions enabled
//$body = file_get_contents('contents.html');
//$body = preg_replace('/\\\\/','', $body); //Strip backslashes
$to = $_POST['to'];
$mail->CharSet="GB2312";//设置邮件字符编码否则邮件会乱码
$mail->Encoding="base64";
$mail->IsSMTP(); // tell the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 25; // set the SMTP server port
$mail->Host = "smtp.qq.com"; // SMTP server
$mail->Username = "[email protected]"; // SMTP server username
$mail->Password = "000000000000"; // SMTP server password
//$mail->IsSendmail(); // tell the class to use Sendmail
$mail->AddReplyTo("[email protected]","han qing");
$mail->From = "[email protected]";
$mail->FromName = "han qing";
//$to = "[email protected]";
$mail->AddAddress($to);
$mail->Subject =$mail->Subject = "=?utf-8?B?" . base64_encode("First PHPMailer Message") . "?=";
$mail->Body = "<h1>phpmailer演示</h1> 这是用PHPMAILER发的第一份邮件,从QQ邮箱发到Google邮箱.";
$mail->AddAttachment("F:/myloe.jpg");
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap
//$mail->MsgHTML($body);
$mail->IsHTML(true); // send as HTML
$mail->Send();
echo 'Message has been sent.';
} catch (phpmailerException $e) {
echo $e->errorMessage();
}
?>
⑸ 在ubuntu中,如何打开php测试页
如果装了WEB服缺升务器并且能够运行PHP,可以在浏裤猜览器中打开对应页伏纯老面;如果没有装WEB服务器但能运行php,执行 “php 文件名“,可以看到输出的HTML代码。在ubuntu中,如何打开php测试页
⑹ ubuntu下怎么安装sendmail
ubuntu中sendmail函数可以很方便的发送邮件,ubuntu sendmail先要安装两个包。必需安装的两个包:
sudo apt-get install sendmail
sudo apt-get install sendmail-cf
下面几个包是可选的:
squirrelmail //提供webmail spamassassin //提供邮件过滤 mailman //提供邮件列漏薯表支持dovecot // 提供IMAP和POP接收邮件服务器守护进程
squirrelmail //提供webmail spamassassin //提供邮件过滤 mailman //提供邮件列表支持 dovecot // 提供IMAP和POP接收邮件服务器守护进程 注意:
Ubuntu下使用最常用的mail功能,需要安装瞎悄mailutils,
安装命令:sudo apt-get install mailutils
使用带附件的功能,则还需要安装sharutils,
安装命令:sudo apt-get install sharutils;(yum install sharutils )
终端输入命令:ps aux |grep sendmail
输出如下:
root 20978 0.0 0.3 8300 1940 ? Ss 06:34 0:00 sendmail: MTA: accepting connections
root 21711 0.0 0.1 3008 776 pts/0 S+ 06:51 0:00 grep sendmail
说明sendmail 已经安装成功并启动磨搜渣了
⑺ ubuntu下的sendmail 8.14.4如何更改附件大小限制
你所乱仿说的手动编译是不是哗旦纤把这一项添加在迟逗文件“sendmail.mc”最后面,这肯定会出错的。你要添加在
MAILER_DEFINITIONS
MAILER(`local')dnl
MAILER(`smtp')dnl
之前。
⑻ 如何用php结合phpmailer发送邮件
步骤图解教程demo和
phpmailer代码包下载:
看这个博主的文章,新手也能实现php发送邮件:网页链接
⑼ 怎样让Ubuntu系统支持php用mail函数发送邮件
如果需要用盯亏册php的mail()函数来发送邮件, 是需要服务器安装sendmail组件才能支持的, 这个在php的手册中mail()函数部分也有介空冲绍到。 在Ubuntu下安装sendmail的命令: sudo apt-get install sendmail 安装好之后,启动sendmail服务: sudo service sendmail start 有了sendmail的支持,就可以在php中用mail()函数发送邮件凯宏了。
⑽ 检测PHP是否支持sendmail
下载 安装C:\
http://www.apachefriends.org/download.php?xampp-win32-1.5.1.exe
修改设定 C:\xampp\apache\bin\php.ini
############
[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25
; For Win32 only.
;sendmail_from = [email protected]
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "C:/xampp/sendmail/sendmail.exe -t"
##############
修改设定 C:\xampp\缓好裂sendmail\sendmail.ini
(加入 smtp server uses pop3 before smtp authentication)
下载 解压扰闭放在 C:\xampp\htdocs\bbs\install.php
http://www.phpwind.com/4.0/phpwind.zip
启动 C:\xampp\xampp_start.exe
进袜余行安装 http://localhost/bbs/install.php 完成!!