<?php
require_once('././php_mailer/class.phpmailer.php');
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP(); // telling the class to use SMTP
try {
$mail->Host = 'tls://mail.sipradi.com.np'; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = 'tls://mail.sipradi.com.np'; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = 'user_name'; // SMTP account username
$mail->Password = 'pass'; // SMTP account password
$mail->AddAddress('something@sipradi.com.np', 'Full Name');
$mail->SetFrom('user_name', '<noreply@sipradi.com.np>');
$mail->Subject = $subject;
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
$mail->MsgHTML($message);
if($mail->Send()){
echo "Message Sent OK<p></p>\n"; die;
}else{
echo 'fail'; die;`
`
}
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
?>发布于 2013-12-24 15:56:29
user name
、
我认为问题出在端口设置上。

发布于 2014-01-21 21:06:51
从documentation $Host
$Host
SMTP主机。
单个主机名或多个分号分隔的主机名。您还可以使用以下格式为每个主机指定不同的端口:smtp1.example.com:25;smtp2.example.com。主机将按顺序进行尝试。
和$SMTPSecure
$SMTPSecure
安全连接前缀。
选项:"“、"ssl”或"tls“
这意味着,您的SMTP服务器
$mail->Host = 'tls://mail.sipradi.com.np'; // SMTP server应该是
$mail->Host = 'mail.sipradi.com.np'; // SMTP server如果您想使用TLS
$mail->SMTPSecure = 'tls';最后但并非最不重要的一点是,您还可以尝试不同的端口587,方法是设置
$mail->Port = 587;或在SMPT服务器的设置中
$mail->Host = 'mail.sipradi.com.np:587'; // SMTP serverhttps://stackoverflow.com/questions/20756902
复制相似问题