can not send email by php on my server

blog

Verified User
Joined
Jan 28, 2011
Messages
131
Hi

I can get/send email by Squirrelmail

But when use phpmailer to send email from my website email is not sent

this is function:

function send()
{
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = 'mail.mydomain.com';
$mail->Port = 465;
$mail->Username = '[email protected]';
$mail->Password = 'password';
$mail->From = '[email protected]';
$mail->FromName = 'myname';
$mail->AddAddress($this->_tpl_vars['TO']);
if (isset($this->_tpl_vars['CC']))
{
$cc = explode(';', $this->_tpl_vars['CC']);
foreach ($cc as $c)
if (!empty($c))
$mail->AddCC($c);
}
$mail->AddReplyTo('[email protected]');
$i = array();
$i = 3;
$mail->IsHTML(true);
$mail->Subject = $this->_tpl_vars['SUBJECT'];
$mail->Body = $this->_tpl;
@$mail->Send();
}
 
Hello,

Try and change:

PHP:
@$mail->Send();

to

PHP:
if(!$mail->Send())  {
   echo "Message could not be sent. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
} 
echo "Message has been sent";

and post here what error you've got there.
 
Does you have a valid SSL cert?

I'm not a programmer, but as far i can see you are connecting to an SSL port without specify anywhere the smtps protocol (maybe in front of the mail.domain.com you should put smtps:// )

For be sure, i would suggest for now to DONT use SSL, so keep everything like that but change port from 465 to 587.

Regards
 
Back
Top