MMS API

MMS API SearchSearch
Author Message
micheal
Posted on Sunday, January 12, 2003 - 03:13 pm:   

Hi Is there an API for use with the MMSC?
Or do i have to use HTTP GET?
Bryce Norwood - NowSMS Support (Bryce)
Posted on Sunday, January 12, 2003 - 11:17 pm:   

Michael,

I assume that you mean for submitting messages to the MMSC?

The easiest API is to use the SMTP interface to connect to the server. To send to any phone number (not just ones registered on your system), you need to use SMTP AUTH to login when you make your SMTP connection.

Then you just submit SMTP messages, with your MMS content as standard MIME encoded file attachments.

(If you don't use SMTP AUTH, you can only send messages via SMTP to users that are defined on the "MMSC Users" list.)

SMTP AUTH looks a little tricky at first, but it's pretty simple ... a typical session looks something like this: (=> indicates message from server, 220 SMTP Ready
250-Ok
250-AUTH LOGIN
250 HELP
Base64EncodedString (334 Username: )
Base64EncodedString (334 Password: )
235 OK

Normal SMTP dialog from here.

When you submit a message via SMTP, use a "To:" address of phonenumber@mms.domain.name, where mms.domain.name is the domain name that you define as the "Domain Name for MMS E-Mail" on the "MMSC" page of the configuration dialog.

You can also use HTTP. An HTTP GET can be used to post an MMS notification when the content resides on another web server. If, however, you want to post content, you need to do an HTTP POST and use the MIME type "multipart/form-data" instead of the standard "application/x-www-form-urlencoded". This is because the standard HTTP POST form format does not support uploading of file content. You can look at the form that we have for "Send MMS Message" in the web menu interface for some more information on this.

-bn
micheal
Posted on Tuesday, January 14, 2003 - 03:56 am:   

Thanx Bryce for your help.

I'm a newbie. Can you guide me to how i could use an SMTP interface technically?
Bryce Norwood - NowSMS Support (Bryce)
Posted on Tuesday, January 14, 2003 - 10:27 pm:   

Michael,

It looks like my previous message was a little garbled, on top of everything else.

So, I'll explain that SMTP interface a little bit more.

But before I do that, it might be worth talking a little bit more about the HTTP interface. Connecting via HTTP is also possible, but the problem is that in order to post the contents of a file via HTTP, you can't do it with a simple HTTP GET, or even a simple HTTP POST.

When a web form (like our web interface) includes a form that includes a "file upload", in order to send it via HTTP, the form data needs to be encoded in the MIME type "multipart/form-data".

I'm not sure if you use Java or not ... unfortunately, I'm not much of a Java developer. But as we get questions about this from time to time, I was curious if there was any Java support for HTTP file uploads, so I did a web search. I ran across a link at www.jscape.com that looked interesting. They have something called the iNet Factory, and it has a bunch of Java classes ... one that greatly simplifies the process of doing an HTTP file upload.

The HttpRequest class in that library has support for HTTP file uploads.

In a POST to the HTTP port of the SMS Gateway (same port as handles the web menu interface), you can do a POST of "multipart/form-data" where "MMSFile" is the field name of any MMS content. The only other required field is "PhoneNumber".

If you're a Java developer, that might be worth looking at.

Okay ... back to SMTP.

SMTP is a relatively simple protocol. The only hard part of it is the actual encoding of message data into a message file. 8-bit data typically gets encoded as 7-bit data using BASE64 encoding.

So you need to create a message file, something like this:

--BEGIN MESSAGE EXAMPLE--
To: phonenumber@mms.domain
From: sender@xyz.com
Subject: Test MMS Message
Content-type: multipart/mixed; boundary="xyz-boundary-string"

--xyz-boundary-string
Content-type: text/plain


--xyz-boundary-string
Content-type: application/vnd.wap.mms.message; name="test.mms"
Content-transfer-encoding: base64

BASE64EncodedDataHere

--xyz-boundary-string--

--END MESSAGE EXAMPLE--

To transmit the message file via SMTP, you connect to port 25 (the standard SMTP port).

The dialog looks something like this (IN means from server, OUT means from client):

IN: 220 SMTP Ready
OUT: HELO client.name
IN: 250 OK
OUT: AUTH LOGIN
IN: 334 VXNlcm5hbWU6
("Username:" BASE64 encoded)
OUT: dGVzdA==
("test" BASE64 encoded)
IN: 334 UGFzc3dvcmQ6
("Password:" BASE64 encoded)
OUT: dGVzdA==
("test" BASE64 encoded)
IN: 235 Ok
OUT: MAIL FROM:
IN: 250 Ok
OUT: RCPT TO:
IN: 250 Ok
OUT: DATA
IN: 354 Ok, end with "." on a new line...
OUT: (Transmit MIME encoded message, then
end with a line with only the . character)
IN: 250 Message Accepted
OUT: QUIT

Hope that helps!

-bn
micheal
Posted on Thursday, January 16, 2003 - 09:24 am:   

Hi Bryce,

Can i use an email component like www.aspemail.com to compose the mail message?

Thanx for your help.
Bryce Norwood - NowSMS Support (Bryce)
Posted on Thursday, January 16, 2003 - 09:19 pm:   

Michael,

Based on a quick review of the web site, it certianly looks like that should work. They support SMTP Authentication, which is a key.

-bn
NGUYEN DUC DUNG
Posted on Wednesday, September 03, 2003 - 04:22 pm:   

Hi Bryce!
I Have some problems so I need for your Help,I work for Vinaphone Mobile Network(GPC company).
I have a Sim(My netork is GSM).This sim make a call or receive call normally but it is inserted into Nokia phone and send a Message to another nokia phone (assume This phone is B)--> B did not receive Message but if B is not Nokia phone for instance Samsung,Ericsson...-->B receives message Nomarlly.If This Sim Insert into Another phone (not Nokia phone) it send Message to all phone(nokia,samsung,ericsson...) normally .
Please reply me soon,thanks alot.
Bryce Norwood - NowSMS Support
Posted on Friday, September 05, 2003 - 09:09 pm:   

You're talking about SMS right ... not MMS?

I think you're going to have to do some troubleshooting at the SMSC level to see what is going on.

When the phone sends an SMS message, it is not sending it directly to the recipient mobile, it is going to the SMSC. So you'd need to troubleshoot it there and see what is going on.

Good luck!