This commit is contained in:
wangjinlei
2022-08-23 15:20:37 +08:00
parent 6c759de0fb
commit 29c6b4c627
6 changed files with 200 additions and 31 deletions

View File

@@ -76,16 +76,16 @@ function sendEmail($email = '', $title = '', $from_name = '', $content = '', $me
$mail->msgHTML($pre.$content.$net);
//Replace the plain text body with one created manually
$mail->AltBody = '';
if (is_array($attachmentFile)) {
for ($i = 0; $i < count($attachmentFile); $i++) {
$mail->addAttachment($attachmentFile[$i], 'thanks.jpg' . $i); //这里可以是多维数组,然后循环附件的文件和名称
}
} else {
// if (is_array($attachmentFile)) {
// for ($i = 0; $i < count($attachmentFile); $i++) {
// $mail->addAttachment($attachmentFile[$i], 'thanks' . $i.'.jpg'); //这里可以是多维数组,然后循环附件的文件和名称
// }
// } else {
if ($attachmentFile != '') {
//Attach an image file
$mail->addAttachment($attachmentFile, 'thanks.jpg');
$mail->addAttachment($attachmentFile, substr($attachmentFile,strrpos($attachmentFile,DS)+1));
}
}
// }
//send the message, check for errors
if (!$mail->send()) {
$status = 0;
@@ -261,6 +261,24 @@ function my_doiToFrag($data){
}
function my_tg_pushmail($data){
$res = sendEmail($data['email'],$data['title'],$data['title'],$data['content'],$data['tmail'],$data['tpassword'],$data['attachmentFile']);
if(isset($res['status'])){
$log_obj = Db::name('email_log');
$insert['article_id'] = $data['article_id'];
$insert['email'] = $data['email'];
$insert['content'] = $data['content'];
$insert['is_success'] = $res['status'];
$insert['attachment'] = $data['attachmentFile'];
$insert['ctime'] = time();
$log_obj->insert($insert);
$log_obj->close();
}
}
/**
* 增加usermsg
*/