我又来了关于邮件发送问题
By strwei
at 2016-03-28
0人收藏 • 7175人看过
我又来了
有什么问题

- 登录后方可回帖
回复#1 @strwei :
SMTP端口号可能不对。
回复#2 @lincanbin :
没问题啊,邮件滚的端口是587啊
回复#5 @lincanbin :
› 密保邮件发送失败Mailer Error: The following From address failed: cforum : MAIL FROM command failed,Command parsing failed ,501,SMTP server error: MAIL FROM command failed Detail: Command parsing failed SMTP code: 501SMTP server error: MAIL FROM command failed Detail: Command parsing failed SMTP code: 501
回复#6 @strwei :
端口25
回复#8 @lincanbin :
是啊
回复#10 @strwei :
你找他们客服问问。
回复#11 @lincanbin :
官方给的api是这样的
<?php
set_include_path("/usr/local/lib/php/");
include_once 'Mail.php';
include_once 'Mail/smtp.php';
# 发信人,用正确邮件地址替代
$from='testaddress@qq.com';
# 收件人地址,用正确邮件地址替代
$to = array('test1@qq.com','test2@163.com');
# 邮件标题
$subject='SendCloud PHP Smtp Example';
# 邮件正文,html格式
$body = "<html><head></head><body>
欢迎使用<a href='http://sendcloud.sohu.com'>SendCloud!
</body></html>";
# smtp参数, 用正确api_user和api_key验证
$param = array (
'host'=>'smtp.sendcloud.net',
'ip'=>25,
'auth'=>true,
'username'=>'api_user',
'password'=>'api_key');
$headers = array (
'From' => $from,
'To' => $to,
'Subject' => $subject,
'Content-Type' => 'text/html;charset=utf8');
function getMessageId($res)
{
$list = explode('#',$res);
return $list[1];
}
$mail = new Mail_smtp($param);
$res = $mail->send($to, $headers, $body);
$messageId = getMessageId($res);
echo $messageId;示例2
<?php
set_include_path("/usr/local/lib/php/");
require_once "Mail.php";
# 发信人,用正确邮件地址替代
$from = "sendcloud@sendcloud.org";
# 收件人地址,用正确邮件地址替代
$to = "to@sendcloud.org";
$subject = "SendCloud PHP Smtp Example";
# 邮件正文,html格式
$body = "<html><head></head><body>
欢迎使用<a href='http://sendcloud.sohu.com'>SendCloud!
</body></html>";
# 使用api_user和api_key进行验证
$username = "api_user";
$password = "api_key";
$host = "smtp.sendcloud.net";
$port = 25;
$headers = array (
'From' => $from,
'To' => $to,
'Subject' => $subject,
'Content-Type' => 'text/html;charset=utf8');
$smtp = Mail::factory(
'smtp',
array (
'host' => $host,
'port' => $port,
'auth' => true,
'debug' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("" . $mail->getMessage() . "
");
}
else {
echo("Successfully!
");
}
?>回复#12 @strwei :
sendcloud要求的多了一个username,关于这个,你可以直接硬编码到forgot.php里。
回复#13 @lincanbin :
折腾了两天,用Gmail邮箱终于可以了
回复#14 @strwei :
你用QQ或者163或者其他企业邮箱都可以很容易成功的。
回复#15 @lincanbin :
qq邮箱不支持免费域名,163蛋疼的要@的mx记录
回复#15 @lincanbin :
qq邮箱不支持免费域名,163蛋疼的要@的mx记录
回复#16 @strwei :
QQ免费企业邮箱不支持免费域名?
回复#18 @lincanbin :
嗯嗯 tk,cf,ml,ga,top