I have trying to make a smtp connection by using phpmailer and it host on godaddy, it show Connection refused (111) after I try below code. Am I doing something wrong?
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->IsSMTP();
$mail->Host = 'smtpout.asia.secureserver.net';
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true;
$mail->Username = "username@domain.com";
$mail->Password = "mypassword";
$mail->setFrom('username@domain.com', 'sender');
$mail->addAddress('receiver@domain.com');
$mail->Subject = 'Here is the subject';
$mail->Body = 'TEST';
$mail->AltBody = 'This is a plain-text message body';
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
0 comments:
Post a Comment