function mail_to_all_user($receivename, $receivermail, $fromname, $fromemail, $mailbody, $subject) { echo 'asdas'; $mail = new PHPmailer(); //object of mailer function $mail->isHTML(true); $name = $receivename; $emails_to = $receivermail; $mail->FromName = $fromname; $mail->From = $fromemail; $mail->AddAddress($emails_to, $receivename); $mail->Subject = $subject; $mail->Body = $mailbody; $mail->WordWrap = 50; if (!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; return true; } else { return false; } }
/** * @param $content */ public function sendMail($content) { $mail = new PHPmailer(); $mail->isSMTP(); $mail->SMTPDebug = 1; $mail->CharSet = 'utf-8'; $mail->Host = 'smtp.163.com'; $mail->SMTPAuth = true; $mail->Username = '******'; $mail->Password = '******'; //$mail->SMTPSecure = false; $mail->Port = 25; $mail->From = '*****@*****.**'; $mail->FromName = '12306提醒'; $mail->addAddress('*****@*****.**'); $mail->isHTML(true); $mail->Subject = '居然还有票~'; $mail->Body = $content . '<br /><br /><br /><a href="https://kyfw.12306.cn/otn/lcxxcx/init">赶紧去12306抢票吧~</a>'; if (!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } }