This commit is contained in:
wangjinlei
2021-12-20 17:12:23 +08:00
parent c80c9f8da7
commit 49f170a778
12 changed files with 1784 additions and 390 deletions

View File

@@ -39,6 +39,25 @@ function object_to_array($obj) {
return $obj;
}
function choiseJabbr($article_id,$jabbr){
if($article_id<1799&&$jabbr=="Cancer Adv"){
return "TMR Cancer";
}
if($article_id<910&&$jabbr=="Microenviron Microecol Res"){
return "Tumor Microenviron Res";
}
if($article_id<1799&&$jabbr=="Med Theor Hypothesis"){
return "TMR Theory Hypoth";
}
if($article_id<1821&&$jabbr=="Clin Res Commun"){
return "TMR Clin Res";
}
if($article_id<1700&&$jabbr=="Aging Commun"){
return "TMR Aging";
}
return $jabbr;
}
/**
* @function sendEmail
* @intro 发送邮件(带附件)
@@ -111,6 +130,94 @@ function sendEmail($email = '', $title = '', $from_name = '', $content = '', $me
return ['status' => $status, 'data' => $data]; //返回值(可选)
}
function sendEmail1($email = '', $title = '', $from_name = '', $content = '', $memail = '', $mpassword = '', $attachmentFile = '') {
date_default_timezone_set('PRC');
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 0;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//charset
$mail->CharSet = 'UTF-8';
//Set the hostname of the mail server
$mail->Host = "smtp.yeah.net"; //请填写你的邮箱服务器
// $mail->Host = "smtp.126.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25; //端口号
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = $memail == '' ? "tmrweb@tmrjournals.com" : $memail; //发件邮箱用户名
//Password to use for SMTP authentication
$mail->Password = 'OBRTWMJCTWRKRMRP';//$mpassword == '' ? "Wu999999tmrwe" : $mpassword; //发件邮箱密码
//Set who the message is to be sent from
$mail->setFrom($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
//Set an alternative reply-to address(用户直接回复邮件的地址)
$mail->addReplyTo($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
//Set who the message is to be sent to
$mail->addAddress($email);
//Set the subject line
$mail->Subject = $title;
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML($content);
//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.pdf' . $i); //这里可以是多维数组,然后循环附件的文件和名称
}
} else {
if ($attachmentFile != '') {
//Attach an image file
$mail->addAttachment($attachmentFile, 'thanks.pdf');
}
}
//send the message, check for errors
if (!$mail->send()) {
$status = 0;
$data = "邮件发送失败" . $mail->ErrorInfo;
} else {
$status = 1;
$data = "邮件发送成功";
}
return ['status' => $status, 'data' => $data]; //返回值(可选)
}
function aliemail($email,$title,$content){
file_put_contents('/usr/a.txt', $email,FILE_APPEND);
vendor('aliemail.email');
$mailto=$email;
$mailsubject=$title;
$mailbody=$content;
$smtpserver = "smtpdm-ap-southeast-1.aliyun.com";
$smtpserverport = 80;
$smtpusermail = "propa@hellotmr.top";
// 发件人的账号,填写控制台配置的发信地址,比如xxx@xxx.com
$smtpuser = "propa@hellotmr.top";
// 访问SMTP服务时需要提供的密码(在控制台选择发信地址进行设置)
$smtppass = "Wu751019Pnx";
$mailsubject = "=?UTF-8?B?" . base64_encode($mailsubject) . "?=";
$mailtype = "HTML";
//可选,设置回信地址
$smtpreplyto = "13662001490@126.com";
$smtp = new \smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
$smtp->debug = false;
$cc ="";
$bcc = "";
$additional_headers = "";
//设置发件人名称,名称用户可以自定义填写。
$sender = $title;
$res = $smtp->sendmail($mailto,$smtpusermail, $mailsubject, $mailbody, $mailtype, $cc, $bcc, $additional_headers, $sender, $smtpreplyto);
return $res;
}
/**
* 生成文章sn号
* @return type