我正在尝试使用PHPMailer发送两封电子邮件。一个用于客户,一个用于管理。发送到客户端的电子邮件工作正常,但当我尝试向我的域名地址发送电子邮件时,它无效,但PHPMailer显示成功消息。
require_once 'class.phpmailer.php';
require_once 'class.smtp.php';
$mail = new PHPMailer;
//$mail->isSMTP(); //When uncomment gives an error
$mail->Host = 'http://smtp-in-114.livemail.co.uk/'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'info@mydomain.com'; // SMTP username
$mail->Password = 'mypass';
$mail->Port = 466;
//$mail->SMTPDebug = 3; // Enable verbose debug output
//$mail->isSMTP(); // Set mailer to use SMTP
// TCP port to connect to
$mail->addAddress('info@mydomain.com'); // Add a recipient
$file_name = 'claimforms/' . $file_name;
$mail->addAttachment($file_name); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'New Online Claim Form';
$mail->Body = 'You have a new online MS claim. Please see attached documents</b>';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}