Phpmailer

Hi

I am using phpmailer function. But I got error.Can anyone…

SMTP Error: Could not connect to SMTP host. Error sending: SMTP Error: Could not connect to SMTP host.

I think your SMTP configuration is not correct. Are you trying in the offline system or in LIVE servers? Try to set SMTP, in your php.ini if you are in local system and try.

BTW can you show us your code how you have tried so far?

Sure. rajug


<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->CharSet ="utf-8"; // You can adjust the Charset according to your language
$mail->IsSMTP();
$mail->Host = "webmail.getwiseconsulting.com";
$mail->From="mariyappan@getwiseconsulting.com"; //REMEMBER, this MUST be same as your authorization email address above.
$mail->FromName="My site's mailer";
$mail->SMTPAuth = true;
$mail->Username = "mariyappan@getwiseconsulting.com";
$mail->Password = "123456";

$mail->AddAddress("mariyappan@getwiseconsulting.com");
$mail->Subject = "Test 1";
$mail->Body = "Test 1 of PHPMailer.";

if(!$mail->Send())
{
   echo "Error sending: " . $mail->ErrorInfo;;
}
else
{
   echo "Letter is sent";
}
?>

Have you checked your smtp port? By default it takes: 25
Basic Usage Example:
http://phpmailer.worxware.com/index.php?pg=exampleasmtp

I tried. Again the same error.

It doesnt seem in the above code that you have given the correct port. Did you try giving the port as well? And are you sure the port you passed is correct port?

BTW, did you try sending emails by PHP Mail function if it works? Try once just sending the email without SMTP.


require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->CharSet ="utf-8"; // You can adjust the Charset according to your language
$mail->From="mariyappan@getwiseconsulting.com"; //REMEMBER, this MUST be same as your authorization email address above.
$mail->FromName="My site's mailer";
$mail->AddAddress("mariyappan@getwiseconsulting.com");
$mail->Subject = "Test 1";
$mail->Body = "Test 1 of PHPMailer.";

Again the same error. Simple mail function is not working in this site.