修改发送邮件方式

This commit is contained in:
aixiao 2023-03-29 12:54:03 +08:00
parent ba6040f16a
commit 7133de2456

View File

@ -40,7 +40,7 @@ static int error_log(float l_t, int c_t, char *log_file, char *recv_mail, int _i
// 关机活重启时
sprintf(temperature, "%d.%d.%d %d:%d:%d %s %.3f℃ %s %.3f℃\n", (1900 + tmp_ptr->tm_year), (1 + tmp_ptr->tm_mon), tmp_ptr->tm_mday, tmp_ptr->tm_hour, tmp_ptr->tm_min, tmp_ptr->tm_sec, "Raspberry CPU temperature", l_t, "Restartable or shutdown temperature",
(float)c_t);
sprintf(buffer, "email -r %s -s \"Raspberrypi Temperature\" -t \"%s\"", recv_mail, temperature);
sprintf(buffer, "gomail -r %s -s \"Raspberrypi Temperature\" -t \"%s\"", recv_mail, temperature);
fp = popen(buffer, "r");
pclose(fp);
fp = NULL;
@ -48,7 +48,7 @@ static int error_log(float l_t, int c_t, char *log_file, char *recv_mail, int _i
// 正常温度时
if (tmp_ptr->tm_min >= 10 && tmp_ptr->tm_min < 12) {
sprintf(temperature, "%d.%d.%d %d:%d:%d %s:%.3f℃\n", (1900 + tmp_ptr->tm_year), (1 + tmp_ptr->tm_mon), tmp_ptr->tm_mday, tmp_ptr->tm_hour, tmp_ptr->tm_min, tmp_ptr->tm_sec, "Raspberry CPU temperature", l_t);
sprintf(buffer, "email -r %s -s \"Raspberrypi Temperature\" -t \"%s\"", recv_mail, temperature);
sprintf(buffer, "gomail -r %s -s \"Raspberrypi Temperature\" -t \"%s\"", recv_mail, temperature);
fp = popen(buffer, "r");
pclose(fp);
fp = NULL;