0

Please help, i already posted a relative question regarding with this matter. I have a code that has no error and a message:

SMTP -> FROM SERVER:220 itech.urc.local Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Thu, 7 Nov 2013 20:44:46 +0800 
SMTP -> FROM SERVER: 250-itech.urc.local Hello [192.168.56.100] 250-AUTH GSSAPI NTLM LOGIN 250-AUTH=LOGIN 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY 250 OK 
SMTP -> FROM SERVER:250 2.1.0 itechweb-mail@itechglobal.com.ph....Sender OK 
SMTP -> FROM SERVER:250 2.1.5 algie.rosario@yahoo.com 
SMTP -> FROM SERVER:354 Start mail input; end with . 
SMTP -> FROM SERVER:250 2.6.0 <7319fa99244aea2045353a8769d0f46b@192.168.56.100> Queued mail for delivery 
Message sent

And this is my Code:

<?php 
include('PHPMailer_5.2.0/class.phpmailer.php');
include('PHPMailer_5.2.0/class.smtp.php');


$mail             = new PHPMailer();
$body             = file_get_contents('PHPMailer_5.2.0/examples/contents.html');
$body             = eregi_replace("[\]",'',$body);


$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = "linkmpr01.urc.local"; // SMTP server
$mail->SMTPDebug  = 2;                     // enables SMTP debug information 


$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = "whatever.local"; // sets the SMTP server
$mail->Port       = 25;                    // set the SMTP port for the GMAIL server
$mail->Username   = "whatever"; // SMTP account username
$mail->Password   = "whatever";        // SMTP account password


$mail->SetFrom('ethnicweb-mail@ethnicglobal.com.ph', 'First Last');
$mail->AddReplyTo("ethnic-mail@ethnicglobal.com.ph","First Last");
$mail->Subject    = "PHPMailer Test Subject via smtp, basic with authentication";
$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";       
$mail->MsgHTML($body); 

$address = "algie.rosario@yahoo.com";
$mail->AddAddress($address, "John Doe");


$mail->AddAttachment("PHPMailer_5.2.0/examples/images/phpmailer.gif");      
$mail->AddAttachment("PHPMailer_5.2.0/examples/images/phpmailer_mini.gif"); 


if(!$mail->Send()) 
{
echo "Mailer Error: " . $mail->ErrorInfo;
} 
else 
{
echo "Message sent!";
}

This codes works fine with me, and the only problem is that it didn't send anything to the recipient. Please help.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
  • Remove the username and passwords! You might be sharing sensitive data. Secondly, do check if authentication to server (host) is valid or not. – PC. Nov 07 '13 at 13:08
  • set $mail->SMTPDebug = 2; By the way, which SMTP server URL is this linkmpr01.urc.local ? and check if TLS is required and test with below line also once. $mail->SMTPSecure = "tls"; – PC. Nov 07 '13 at 13:11
  • @Pramod - sorry but i tried to remove/ change my password and username but "SMTP -> ERROR: Username not accepted from server" appear. Also i tried to change my server/host and it stated "Could not connect to SMTP host". So i assume that there is nothing wrong with that area. I also tried sending an external recipient with the use of MS Outlook (which was the server/host also) and it works fine. – Algie Rosario Nov 07 '13 at 13:16
  • @Pramod - if you anlyze and read the above code, the $mail->SMTPDebug is already set to 2. and if i add $mail->SMTPSecure = "tls", an error appear like "SMTP -> FROM SERVER:554 5.7.3 Unable to initialize security subsystem" as well as $mail->SMTPSecure = "tls" that shows "SMTP -> ERROR: Failed to connect to server: (0)"; – Algie Rosario Nov 07 '13 at 13:18
  • the linkmpr01.urc.local is the host/server for our Ms Outlook. – Algie Rosario Nov 07 '13 at 13:36
  • My code already work, it's just the wrong server/host i used. Sorry for the disturb. – Algie Rosario Nov 08 '13 at 08:05
  • Everything seems to be perfect, except the host address linkmpr01.urc.local for me. Let me get back to you on this. – PC. Nov 08 '13 at 10:10
  • I could send email just by changing HOST and credentials. There must be problem with the host linkmpr01.urc.local. I think you have given intranet reference address for host. if you could change it to something else i.e. internet referable address, your problem will be solved. – PC. Nov 08 '13 at 10:29

1 Answers1

1

Problem is with SMTP server address

    $mail->Host       = "linkmpr01.urc.local"; 

Change it to actual Server address (not intranet server address). I hope it will work fine.

PC.
  • 481
  • 7
  • 23