public function email() { $mail = \Tools\mail\Mail::getInstance(); $res = $mail->send(1, 2, '*****@*****.**', '*****@*****.**', '3'); if ($res) { echo '发送成功'; } else { echo '发送失败'; } }
/** * 发送邮件 */ function sendMail($subject, $body, $to, $from = '', $fromname = '') { if (!$subject || !$body || !$to) { return FALSE; } $from = $from ? $from : C('setting.admin_email'); $fromname = $fromname ? $fromname : C('setting.admin_name'); $mail = \Tools\mail\Mail::getInstance(); return $mail->send($subject, $body, $from, $fromname, $to); }