forked from fanruan/finekit
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.6 KiB
58 lines
1.6 KiB
6 years ago
|
package com.fanruan.api.util;
|
||
|
|
||
|
import com.fanruan.api.util.shell.BaseSmsBody;
|
||
|
import com.fanruan.api.util.shell.EmailBody;
|
||
|
import com.fr.base.EmailManager;
|
||
|
import com.fr.base.sms.SMSManager;
|
||
|
|
||
|
/**
|
||
|
* @ClassName TransmissionKit
|
||
|
* @Author zack
|
||
|
* @Date 2019/8/23
|
||
|
* @Version 10.0
|
||
|
* fine kit for data transmission.(eg. email or sms...)
|
||
|
*/
|
||
|
public class TransmissionKit {
|
||
|
/**
|
||
|
* 服务端是否支持短信服务
|
||
|
*
|
||
|
* @return 支持返回true 否则false
|
||
|
*/
|
||
|
public static boolean isSmsFuncSupport() {
|
||
|
return SMSManager.getInstance().isSMSFuncSupport();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 发送短信
|
||
|
*
|
||
|
* @param baseSmsBody 短信实体
|
||
|
* @return 发送成功返回true 否则false
|
||
|
* @throws Exception
|
||
|
*/
|
||
|
public static boolean sendSms(BaseSmsBody baseSmsBody) throws Exception {
|
||
|
return baseSmsBody.send();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 发送邮件
|
||
|
*
|
||
|
* @param emailBody 邮件实体
|
||
|
* @return 发送成功返回true否则false
|
||
|
* @throws Exception
|
||
|
*/
|
||
|
public static boolean sendEmail(EmailBody emailBody) throws Exception {
|
||
|
EmailManager.getInstance().send(
|
||
|
emailBody.getToAddress(),
|
||
|
emailBody.getCcAddress(),
|
||
|
emailBody.getBccAddress(),
|
||
|
emailBody.getFromAddress(),
|
||
|
emailBody.getSubject(),
|
||
|
emailBody.getBodyContent(),
|
||
|
emailBody.getAttaches(),
|
||
|
emailBody.getFormat(),
|
||
|
emailBody.getContentAttaches(),
|
||
|
emailBody.getSessionId()
|
||
|
);
|
||
|
return true;
|
||
|
}
|
||
|
}
|