i want to send details from a form using the phpmailer function but i have the error:
SMTP connect() failed. message could not be sent.
mailer error:SMTP connect() failed.
//start of phpmailer
<?php
mailer error:SMTP connect() failed.
require_once '_libs/PHPMailer/PHPMailerAutoload.php';
$m= new PHPMailer;
$m->isSMTP();
$m->SMTPAuth=true;
$m->SMTPSecure = "tls";
$m->SMTPDebug=2;
$m->Host ="ssl:smtp.gmail.com:465";//my mail host
$m->Username='myusername@gmail.com';
$m->Password=##########;
$m->From='email@gmail.com';
$m->AddAddress("admin@mydomain.com");
$m->AddReplyTo('myusername@gmail.com'); // Reply TO
$m->FromName="{$firstname}";
$m->Subject='paper order';
$m->WordWrap = 50;
$m->isHTML(true);
$m->Body="the details of the order are firstname {$firstname} <br> lastname {$lastname}";
if(!$m->Send())
{
echo "message could not be sent.<p>";
echo"mailer error:" .$m->ErrorInfo;
exit;
}
echo "Message has sent";
?