经测试代码如下:
/**
* 通过joomla jmail 类使用 gmail smtp 账号发送邮件
*
* @param
* @arrange (512.笔记) jb51.cc
**/
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();
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
原文链接:https://www.f2er.com/php/528974.html