Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Any one can help me to find out problem to send SMS?

 
Yatin Shah
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sir,

Please, check my following code is it correct or not? Because, I can received E-mail But I am not getting message on Mobile.

//package com.psol.xslist;

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;

public class SendMessage
{
public static final void main(String[] args)
{
try
{
Properties props = System.getProperties();
props.put("mail.smtp.host","172.24.11.19");
Session session = Session.getDefaultInstance(props);
Message message = new MimeMessage(session);
InternetAddress from = new InternetAddress("administrator@msubaroda.ac.in");
InternetAddress to[] = InternetAddress.parse("yatin_39@hotmail.com,9825343210@west.hutch.co.in");
message.setFrom(from);
message.setRecipients(Message.RecipientType.TO,to);
message.setSubject("Server Information");
message.setSentDate(new Date());
message.setText("Server is working.");
Transport.send(message);
}
catch(MessagingException e)
{
System.err.println(e.getMessage());
}
}
}

Thanking You
Yatin
 
Ashish Chopra
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi yatin...

have u tried sending an e-mail to :"9825343210@west.hutch.co.in"(your number i guess) and checked if u receive an sms with the same contents? check if that works first...

there may be 2 problems:
a) The service provider doesn't support such a service.
b) The format of sms may not be MIME formats.

maybe u can check this out and post it so we can think more on this one....
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm moving this to the J2ME forum where SMS is talked about more often.

So please post your replies there. Thanks!
 
Yatin Shah
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Yes I tried No. of times but I am not getting SMS. It shows Message has been sent. By chance, If you have some other method to do. Please, let me know. I am staying in Gujarat, India. Is there any special address to send SMS? Please, let me know.

Thanking You
Yatin
[ December 10, 2004: Message edited by: Yatin Shah ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic