Sunday 12 September 2010

Send mail with joomla jmail class using gmail smtp account

jimport('joomla.mail.mail');
$mail = new JMail();
$mail->setsender("useremail");
$mail->addRecipient("destination@email.com");
$mail->setSubject("Here goes the subject");
$mail->setbody("The body of mail");
$mail->addAttachment('c:\\1.pdf');
$mail->useSMTP(true, "smtp.gmail.com", "useremail", "password",'ssl',465);
$mail->send();