Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9068129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:07:01+00:00 2026-06-16T17:07:01+00:00

I have the below code which right now does just what i need (send

  • 0

I have the below code which right now does just what i need (send a text message to a cell phone using java).

Now my question is a little more specific, and I am not really sure what it entails or if it is even possible.

The question is as follows:

1 – When I send this e-mail, each time a generic (temporary?) sender is created (presumably on the gmail side) that looks always something like "1 (410) 000-00x", where x appears to iterate up/down (I have only done a couple tests). Now, this code below is part of a real time intraday e-mailing mechanism to communicate data to a human, for them to take a certain action.

2 – Because of this, it would be optimal to have the sender be my sample abc@gmail.com but this does not happen. Is there a way to force this to occur? Should I use something other than gmail?

Any pointers are appreciated.

NOTE:

I think this may come up so I will just say now: the action is EXTREMELY time sensitive. With this, e-mail is not quite responsive enough, while text messages are immediately received. I agree sending an e-mail would immediately solve the problem.

    public static void sendIT() throws AddressException, MessagingException, javax.mail.MessagingException
    {


    String host = "smtp.gmail.com";
    String from = "abc@gmail.com";
    String pass = "test";
    Properties props = System.getProperties();
    props.put("mail.smtp.starttls.enable", "true"); // added this line
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.user", from);
    props.put("mail.smtp.password", pass);
    props.put("mail.smtp.port", "587");
    props.put("mail.smtp.auth", "true");

    String[] to = {"5555555555@txt.att.net"};

    Session session = Session.getDefaultInstance(props, null);
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));

    InternetAddress[] toAddress = new InternetAddress[to.length];

    //message.setFileName(g.destFileTracker);
    // To get the array of addresses
    for( int i=0; i < to.length; i++ ) { // changed from a while loop
        toAddress[i] = new InternetAddress(to[i]);
    }
    System.out.println(Message.RecipientType.TO);

    for( int i=0; i < toAddress.length; i++) { // changed from a while loop
        message.addRecipient(Message.RecipientType.BCC, toAddress[i]);
    }


    message.setSubject("Activity");
    message.setText("test");
    Transport transport = session.getTransport("smtp");
    transport.connect(host, from, pass);
    transport.sendMessage(message, message.getAllRecipients());
    transport.close();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:07:03+00:00Added an answer on June 16, 2026 at 5:07 pm

    You should try using the mms gateway rather than the txt gateway. The mms gateway will keep the email address. So instead of being txt.att.net it will be mms.att.net.

    If this is time sensitive though, you should probably stick with a SMS solution and go third party since I find MMS isn’t as reliable with speed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have below code which overrides equals() and hashcode() methods. public boolean equals(Object obj)
I have below snippet of code in which TestClass is extending jPanel which is
I want to know is below code correct ? I have following code which
I have the code below which I use clone() and live() . The code
I have the code below which I use clone() and delegate() . The code
I have the below code, which iterates over a list based on a custom
I have the below code for my a Dialog box for a which contains
I have the following code below which works, but I want to insert values
I have below is the html code for TD which gets appended after matching
I want to exclude cobertura from instrumenting code if test=true. Right now I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.