package com.szwl.util; import com.szwl.model.utils.MailUtil; import lombok.extern.slf4j.Slf4j; @Slf4j public class WechatSendUtil { /** * 发送邮件 * @param email * @param name * @param zoneID */ public static void sentEmail(String email, String name, String zoneID, String machineType) { String machineTypeStr = ""; switch (machineType) { case "0": machineTypeStr = "Cotton Candy"; // 棉花糖 break; case "1": machineTypeStr = "Popcorn"; // 爆米花 break; case "2": machineTypeStr = "Ice Cream"; // 冰淇淋 break; default: machineTypeStr = ""; } String subject = "Error message from " + machineTypeStr + " Machine"; StringBuffer content = new StringBuffer(); String str1 = " Machine name: "; String str2 = "
" + " Error message: "; String sContent = "Abnormal shutdown/The network is disconnected."; String str3 = "
" + " Time&Date: "; // String nowDateUTC = DateTimeFmtUtil.getNowDateUTC(); String timeByZoneID = TimezoneFmtUtil.getTimeByZoneID(zoneID); String str4 = "
" + "
" + "Dear customer:
"; String str5 = " This is an automatic-sent mail to inform you that there is an error occurred on one of your " + machineTypeStr + " machines, please kindly check the details as above.
"; String str6 = "
You don't have to reply this mail. What you need to do is to follow the instructions on the touch screen to clear the error and recover the machine. If there is any question or more information you need. Please do not be hesitated to contact your distributor.
" + "
" + " Thank you for choosing our machine!
" + "
" + "
" + "Best Regards.
" + "Cotton Candy Service Team"; content.append(str1).append(name).append(str2).append(sContent).append(str3).append(timeByZoneID).append(str4).append(str5).append(str6); MailUtil mailUtil = new MailUtil(); mailUtil.send(email, subject, content.toString()); System.out.println("邮件发送成功"); } /** * 发送邮件 * @param email * @param name * @param zoneID */ public static void sentEmail(String email, String name, String zoneID, String machineType, String alarmContent) { String machineTypeStr = ""; switch (machineType) { case "0": machineTypeStr = "Cotton Candy"; // 棉花糖 break; case "1": machineTypeStr = "Popcorn"; // 爆米花 break; case "2": machineTypeStr = "Ice Cream"; // 冰淇淋 break; default: machineTypeStr = ""; } String subject = "Error message from " + machineTypeStr + " Machine"; StringBuffer content = new StringBuffer(); String str1 = " Machine name: "; String str2 = "
" + " Error message: "; // String sContent = "Abnormal shutdown/The network is disconnected."; String str3 = "
" + " Time&Date: "; String timeByZoneID = TimezoneFmtUtil.getTimeByZoneID(zoneID); String str4 = "
" + "
" + "Dear customer:
"; String str5 = " This is an automatic-sent mail to inform you that there is an error occurred on one of your " + machineTypeStr + " machines, please kindly check the details as above.
"; String str6 = "
You don't have to reply this mail. What you need to do is to follow the instructions on the touch screen to clear the error and recover the machine. If there is any question or more information you need. Please do not be hesitated to contact your distributor.
" + "
" + " Thank you for choosing our machine!
" + "
" + "
" + "Best Regards.
" + "Cotton Candy Service Team"; content.append(str1).append(name).append(str2).append(alarmContent).append(str3).append(timeByZoneID).append(str4).append(str5).append(str6); MailUtil mailUtil = new MailUtil(); mailUtil.send(email, subject, content.toString()); System.out.println("邮件发送成功"); } }