use of com.aliyuncs.exceptions.ClientException in project sailfish-mfa by picos-io.
the class AliyunSmsSender method sendPasscode.
@Override
public void sendPasscode(String toPhoneNumber, String code) {
SendSmsRequest request = new SendSmsRequest();
try {
request.setMethod(MethodType.POST);
request.setSignName(signName);
request.setTemplateCode(passcodeTemplate);
request.setTemplateParam(String.format(PASSCODE_MESSAGE, code));
request.setPhoneNumbers(toPhoneNumber);
SendSmsResponse httpResponse = client.getAcsResponse(request);
// TODO parse code
} catch (ServerException e) {
throw new SmsException(e);
} catch (ClientException e) {
throw new SmsException(e);
}
}
Aggregations