views:

589

answers:

3

I am developing a j2me application and I was wondering if anyone knew how to send an sms message to an email address. I need to use sms since I am trying to send data through it using an unlimited text plan instead of an unlimited data plan.

I modified a code sample from http://freecode-freecode.blogspot.com/2008/06/how-to-send-sms-in-j2me.html but I can't seem to send a message to an email. The relevant code is as follows...

  MessageConnection smsCon= (MessageConnection) Connector.open("sms://[email protected]:25");
  TextMessage txtmessage = (TextMessage) smsCon.newMessage(MessageConnection.TEXT_MESSAGE);
  txtmessage.setAddress("sms://[email protected]:25");// !!
  txtmessage.setPayloadText("Hello from j2me sms api");
  smsconn.send(txtmessage);

but it's not working. I have no idea how to approach this. I sent a text message manually through the phone's built in text messager to the email, but I can't seem to do it in code.

A: 

I don't think it's available with current WMA specification. if you want to create such a service I suggest you to create an SMS gateway that received the SMS, combined with J2SE/J2EE application that connect to internet. The SMS gateway parse the sms content for email address, send to the J2SE/J2EE application and this application create email based on the parameter which email address and the rest of the sms content.

Ari R. Fikri
A: 

You cannot send email as SMS messages unless you have special support either in the entity receiving the SMS or in the SMS Service Center.

It may be that your operator/carrier have support for sending email through the SMS Service Center. Usually this is acheived by sending the SMS to a specific recipient number and coding the email address in the message body surrounded by appropriate markers (*,#,digits). I have sent SMSes to fax like this, but it was more than 10 years ago...

If you operator/carrier has no such support maybe you can find some other SMS-to-email service that works in a similar way.

Update: Found a service: http://www.visualtron.com/sms2email.htm

You can also create your own SMS-to-email gateway in a J2me MIDlet running on a device with an unlimited data plan. Then you need to send your SMSes to a specific port that your gateway MIDlet listens to. The actual email then has to be sent through a SMTP or HTTP connection. This is not a solution I would recommend as it is rather fragile.

Note that JSR-120 and JSR-205 (the two wireless messageing JSRs) only specify support for SMS and MMS messages but that an implementation MAY add other messaging schemes. From my quick look at the specs I could not fins any way to determine which schemes are supported by a specific device. It should also be noted that MMS also requires a data connection, but operators/carriers often use separate connections and prices for MMS and other data. So even if your device supports an "email://" scheme, it would require a data connection to work.

Ola
A: 

Any handset supporting JSR 205 should be able to do this roughly as follows (not compiled or tested!!):

 MessageConnection emailCon = (MessageConnection) Connector.open("mms://[email protected]");
 MultipartMessage email = (MultipartMessage) emailCon.newMessage(MessageConnection.MULTIPART_MESSAGE);
 email.setSubject("Hello from j2me WMA 2.0 api");
 // add some MessageParts in here...
 emailCon.send(email);

The specification for an MMS URL outlines that an email address is a valid MMS destination.

funkybro