Nexmoメールプラットフォームインタフェースで出会った穴
1611 ワード
この間、会社の要求に基づいて海外のメールプラットフォームNexmoを運用してメールを送る穴に出会ったまとめをしました!
ダイレクトコード
ダイレクトコード
// accountSid authToken
AuthMethod auth = new TokenAuthMethod(accountSid, authToken);
NexmoClient client = new NexmoClient(auth);
SmsSubmissionResult[] responses = new SmsSubmissionResult[0];
String contentUCS2 = "";
try {
// : !
//
// %10 ,
String strUCS2 = URLEncoder.encode(content, "UnicodeBigUnmarked");
contentUCS2 = URLDecoder.decode(strUCS2, "UnicodeBigUnmarked");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
try {
responses = client.getSmsClient().submitMessage(new TextMessage(
//
//
("".equals(from) ? phone : from),
phoneNumble,
contentUCS2, true));
} catch (IOException e) {
e.printStackTrace();
} catch (NexmoClientException e) {
e.printStackTrace();
}
//
for (SmsSubmissionResult response : responses) {
System.out.println(response);
}
}
}
com.nexmo
client
3.4.1
com.googlecode.libphonenumber
libphonenumber
8.9.7