Monday, January 31, 2005

SMTP email attachments from nokia 6600 using t-zones



I wanted to post images to flickr fom my phone and realized that the email app that comes with nokia 6600 (t-mobile) doesnt let you send attachments more than 1K! But as always there are workarounds in the net including an firmware upgrade(!) and using one of those third party email apps possibly with an external SMTP server - and people who tried these have had mixed results. To me, none of the options sounded very appealing so I decided to write my own midlet to send attachments. Moreover having my own midlet meant I can take pictures and send the same in one shot - was defenitely worth trying. So here's is what I did.

1. Use MMAPI to take pictures - basically followed the MMAPI sample program that comes with the WTK. I used VideoControl.USE_DIRECT_VIDEO display mode and png encoding for the snap shot. Here's the caveat: with MMAPI, you'll never get the same resolution as the native camera app. But that was OK, I was just gonna use it for moblogging.

2. Open a simple socket connection to myemail.t-mobile.com, port 25 and Send the picture that you captured using basic SMTP commands. T-mobile uses secure SMTP - so you need to pass in your creditials - no ssl though(btw 6600 do support ssl). Here goes the commands
a) EHLO
b) AUTH PLAIN {Base64 encoding of "\000" + user + "\000" + password}
c) MAIL FROM: < {your email addr} >
d) RCPT TO: < {flickr email addr} >
e) DATA
f) MIME-Version: 1.0
g) From: < {your email addr} >
h) To: < {flickr email addr}>
i) Subject: {some subject line}
j) Content-Type: multipart/mixed; boundary=" {some unique string} "
k) \r\n-- {my unique string}
l) Content-Type:image/png; name=image1.png");
m) Content-Disposition: attachment;filename="image1.png"
n) Content-transfer-encoding: base64
o) \r\n\r\n
p) {Base64 encoding of the image} - just google MIMEBase64 in case you need an impl.
q) \r\n-- {my unique string}
r) \r\n\r\n-- {my unique string} --\r\n
s) .
t) QUIT

3) Add some screens for configuration - email, server, port etc (throw in some RMS code also if you have the time), an Image thumbnail so you can select and preview before you post.

Thats it.. Done! Your very own moblog software is up n running in no time!

Wednesday, January 19, 2005

Tar Ant Task problem



I was using Tar task in one of my build scripts and ran into this error:

[tar] Nothing to do: XXX_XXX_1_0_0.tar is up to date.

This was weird because I got this error when I ran the script for the very first time. It turned out that I had the wrong entry for the "includes" attribute and so bascially tar couldnt find anything to tar up. Talk about misleading error messages!

Tuesday, January 11, 2005

Bluetooth internet with Nokia 6600 and t-zones

I got it working finally! I can now browse internet on my laptop using t-zones from my 6600. Well.. instructions are simple and is listed at a lot of places in the net. Here's is what I did

1. Subscribed to $4.99 t-zones connection from t-mobile. You get limited internet access - via the t-zones proxy - this way. You get to browse both WAP and regular HTML sites from the handset. I have accessed POP3 and SMTP also - not tried any other ports so far.

2. Configured DUN - dial up networking - from Laptop to 6600 over bluetooth. I use Blekin Bluetooth USB adapter - btw I had to update my windows bluetooth drivers with the ones from WIDCOMM. Enabled bluetooth and paired the phone. Set the Paired device (My Laptop) as authorised in the phone - so I dont need to enter PIN every time I connect.

3. Added the following connection string for the modem - In XP, control panel -> modems -> "Bluetooth Modem" (the one that I am using for my DUN) -> properties -> advaned ->Enter-> AT+cgdcont=1,"IP","wap.voicestream.com","",0,0

4. Changed the browser proxy (IE) for my modem connection - NOT the LAN one - as follows
Tools-> InternetOptions->connections -> Bluetooth Modem -> Settings-> Enable Proxy check box -> 216.155.165.50 port 8080.

5. Entered the dial up number for connection as *99# and blank for userid and password.

6. Also I uncheckd the "wait for dial tone" somewhere in the modem configuration.

Thats it. I'm up and running with my wireless internet connection. I felt the browsing speed and reliability is more or less the same as that of a regular dial up.