0

I am trying to send two email using PHPMailer. One for the clients and one for the administration. The email to client is working fine but when I am trying to send an email to my domain's address its not working but PHPMailer is showing success message.

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';
    }
AnwarUlHaq
  • 1
  • 1
  • 2
  • mail providers like microsoft block unauthorized IP's from sending emails to them. If you dig into your logs more closely (read mail file that's on your server) you will see something like 'Unauthorized IP. please go here and fill out this form to whitelist your IP address for this domain' or something like that. – Dimi Feb 06 '17 at 17:02
  • You'll need to turn debugging on to see what the mail server is actually saying – Machavity Feb 06 '17 at 17:06
  • Its sending emails to other mail providers but not to my own domain's address. – AnwarUlHaq Feb 06 '17 at 17:07

0 Answers0