Skip to content

Instantly share code, notes, and snippets.

@davideme
Created January 4, 2018 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davideme/323e89e926346b7cd214927bf0753723 to your computer and use it in GitHub Desktop.
Save davideme/323e89e926346b7cd214927bf0753723 to your computer and use it in GitHub Desktop.
class Sender {
public static void send(String type, String message, String to, String subject) {
if (type == "SMS") {
SMPP smpp = new SMPP("192.168.1.4", "4301");
smpp.openConnection("your­username", "your­password");
smpp.send(to, message, null, "15");
smpp.closeConnection();
} else if(type == "mail") {
SendMailConnection smc = new SendMailConnection("mail.myserver.com");
smc.prepareMessage(to, message, subject);
smc.send();
smc.close();
} else {
throw new RunTimeException("Type is unknown");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment