Sending of sms by Java

Asked

Viewed 1,831 times

1

Speaking personally, I am developing a financial application that I was asked to send a text message to the main administrator. I’m using Java web, Mavem,jsf, Hibernate. Could someone give me a light. Thank you.

  • 2

    It would be important to [Edit] the question and specify what type of hardware will be used for sending the SMS. If you are sending by software, it is up to you to consult the service provider’s specific documentation.

  • Good morning, Silvano, there are several SMS sending Apis available on the internet. I’ve always used the Zenvia API, it’s simple and easy to set up. The API is not free, follow the documentation link: http://docs.zenviasms.apiary.io/#Introduction/status table

1 answer

1


Looking here for Google, I found this implementation here:

package br.com.meupackage;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
public class MailService {
    private final static String userAuthentication = "[email protected]";
    private final static String passwordUserAuthentication = "123456";
    private final static String sender = "[email protected]";
    private final static String smtp = "smtp.gmail.com";
    private final static boolean authentication = true;
    public static void sendMail(String message, String subject, String receiver)
            throws EmailException {
        SimpleEmail email = new SimpleEmail();
        email.setHostName(smtp);
        email.setAuthentication(userAuthentication, passwordUserAuthentication);
        email.setSSL(authentication);
        email.addTo(receiver);
        email.setCharset("UTF-8")
        email.setFrom(sender);
        email.setSubject(subject);
        email.setMsg(message);
        email.send();
        email = null;
    }
}

It is necessary to add in the pom.xml dependence on lib Apache Commons Email.

Source: http://www.guj.com.br/t/enviar-e-mail-jsf/186408/8

  • 2

    What does this have to do with texting?

  • 1

    Wow, I confused total SMS with email at the time of searching, I will remove my reply. Thanks for the warning!

  • @jbueno, can you remove my answer?

  • I cannot. Only the questioner and moderators can do that.

  • Will a specific url be used to send SMS via this url? Example: 192.168.1.88+ String+55+DDD+Phone

  • @Wagnerfilho There is no SMS sending in the reply. She does email sending.

  • Yes! @Wagnerson, I answered wrong! I’m leaving work now, arriving home I make a test for sending SMS and put here the correct answer. It was bad guys! :(((((

  • kkkkk But thanks for the tip even though it wasn’t what you wanted kkkkkkkkkkkkkkkkk Thanks.

  • It was left to erase and it was not until today!?

Show 4 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.