Archive for the ‘Phone’ Category

Flickr now supports O2’s strange photo emails

Tuesday, August 2nd, 2005

This is great news, you can send a email containing a photo directly to flickr from an O2 phone. This means that my previous work should become redundant. However flickr still doesn’t support the attached text message that you may slap with your photo. In my script I have implemented this, and here is how.

Essentially this is what needs to be done.

1) Use wget as before to grab
http://139.2.165.14/mms2legacy/showMessage2.do?encMmsId= ID NUMBER
2) Run through the downloaded page and look for the line containing the string ‘div style=”color: #000000;” ‘
3) When you get to that line, the next line will be blank, skip through to next line.
4) you are now on the line with the text message on, copy that to a variable.
5) remove the tabs and spaces from before the message text

Now you have the message attached to the photo. I would just add this to the email text, flickr would add this to the photo description. Here is a link to the code I used to extract the message written in php. Sorry for the shitness in code, but it works. I hope this is of use to somebody.

More mobile flickr fun

Wednesday, July 27th, 2005

Ok I have the mobile to flickr thing almost sorted, email me if you want to be a tester by the way, O2 UK only (andy DOT shearer AT gmail.com). I will leave that to run for a few weeks before I set up an automated service where people can sign up for it.

A guy on b3ta asked me why did I do this considering flickr has a great mobile upload facility on its mobile site? Well to be honest I should have searched for this sooner, flickr’s mobile site is pretty good. If I hadn’t already made my little work around I would have no doubt used this, but having said that I would point out the clicking of ‘send’ on a picture then selecting the email address is much simpler and quicker than playing around with WAP. Plus later on I might add to it so you can send the photo to multiple address, not just to flickr.

I fixed O2’s photo messaging to email service

Tuesday, July 26th, 2005

47Leading on from this post, I have implemented a way of sending an email from my phone to Flickr containing a full sized image. With thanks to James at Purple Cloud (my host) who installed a newer version of wget for me, everything is now working a-ok. I can now send an email to a pop3 account (based here at mrblack.co.uk) and every minute that account is checked, if everything is fine the email is read, photo extracted, and sent on to flickr as a proper email with a full sized photo attached. Yay!

I am currently thinking about making this available for everybody on O2 who wants to send full sized photos emails from their phone to people or to flickr directly rather than sending them an O2 advert. I might also see if I can set this up for any other carriers who fail to offer full sized email photo attachments. As for the code, I will make it available when I have fully tested the system, and cleaned up all the filthy comments.

My flickr stream

O2, Email and Flickr (Or how I learned not to worry about big companies and devise my own workarounds)*

Sunday, July 24th, 2005

Ok let me start of with a little story. Once upon a time Andy brought a really nice phone, it had a great little camera and was capable of sending MMS, SMS and even emails. Andy was really happy with his phone, he even went to go see Green Day, took some photos and then posted them straight to flickr via email! Andy was the talk of the town, he was super cool, totally fab and now with his new toy, a touch bit sexier.

But then out of the blue 02 changed something which made Andy a very unhappy bunny. 02 in their wisdom had decided to change the way photos were sent by email from a phone. Now instead of attaching the photo file (a happy little .Jpeg) to a fairly blank email, they in its place sent an email in HTML format with no attachments.

Why was (is) Andy so upset with this? Well doing this upset(s) Andy for a few reasons

  • These emails now refuses to work with flickr, as there is no photo attached to the email
  • The email that recipients do receive are covered in O2 branding.
  • The email has some frankly horrible HTML in it. Just look at this photo!
  • The photo messages themselves are now stored online at O2’s site, which technically the whole world can see, In fact go here and see. Imagine if this happened to voice mail messages, where if somebody spent a little time could guess the URL?
  • Andy wasn’t told about the changes.
  • Andy thought that it must be breaking trade practices, as you technically aren’t sending a photo by email. The photo which appears in the email is just the browser going over to O2’s site and getting the image. An annoying difference.
  • When Andy found out about this he was very upset. He cried for a little bit, found somebody to hug, cried a little more but then he decided to write an email to the nasty O2 people that had brought him so much anguish. The email Andy sent basically stated the problems above, pushing the issues of possible breaches in privacy and the fact that he is not actually sending a photo by email. This was Friday, Andy wasn’t expecting anything to be done till next week sometime, so you would think he would have to wait to see the result. Oh, then you don’t know Andy. With a pack of Jaffa cakes, beer, tea and Diet Pepsi, Andy took on 02’s crappy new email in an attempt to make a work around.

    Ok, I am going to change and start speaking in the first person to explain what is going on. I am attempting on my webserver to set up an email account which effectively receives this new shitty O2 email, strips it down, rips out the information, finds and downloads the full sized image from 02’s site and then email it on to flickr. No small feat. I have however found out how O2’s end work, and if you interested in code and how this works, please read on, if not, I would run away.

    First thing I needed was to connect to an email account via pop3 which I would send the email to from my swanky phone. I am going to skip on how to get a script to connect to a pop3 server, and then go through a new email line by line. Although this is complicated, there are some fine examples around. For what it’s worth I just grabbed my trusty wordpress installation and read through the code of wp-mail.php. I then took out all the bits I didn’t need and was left with a script which looks at a pop3 account for a message, if it finds one, it runs through it line by line to make it ready for a post or with a little alteration in our case, an email.

    After that we need to get the URL of the full sized photo stored at O2’s crappy site. To get this URL from the new O2’s photo email there are 2 values that you need to extract from the email message source. These two values are the mmsId and encmmsId. The emcmmsId can be found in the URL labelled “View Message� if you so happen to view the vile email. Here are some fun facts about it

  • It can be found within the email source and is 16 digits long (not sure if this will change).
  • It is in here
    http://139.2.165.14/mms2legacy/showMessage2.do?encMmsId=89D9CC251797CD47
  • It should be easy to find with scripty languages. In this case we want encMmsId to be “89D9CC251797CD47â€?.
  • Ok that’s the first part. Now we need the mmsId. This took me ages to find, but the mmsId is the file name of the image displayed in the email, but without the .jpg extension. Again here are some facts.

  • It can be found in a line which looks like this src=”http://139.2.165.14/MacsService/Macs/ContentService/part/2/email/3874250.jpg”
  • In this case the mmsId is “3874250â€?.
  • Now with these 2 numbers you can grab the actual full sized photo. O2 store these images in some crazy database, so you can’t get a direct link to it like http://www.o2.com/myacephoto.jpg. Oh no, to get the full sized image of our particular example we would use a URL like this

    http://139.2.165.14/mms2legacy/downloadMedia2.d……..

    As you might have spotted we have both Id numbers in there, encMmsId and mmsId. In front of those is what I think is a static IP and script which accept these two variables and another called selectedItem. selectedItem refers to the webpage that we were supposed to visit to get the full sized image, it simply refers to which image is selected to download. So if the message sent from our phone contained more than one picture, this would increment by one, I would presume (not tested).

    Now that is ace, but how on earth do I get a script to automate downloading this image. Well on a Linux/unix/*nix based box you should have wget installed. If you do and its up to date you can run this command. (slightly phpified)

    wget -O /path/to/your/photo/cache/' . $encMmsId . '.jpg --post-data=encMmsId=' . $encMmsId . '&mmsId=' . $mmsId . '&selectedItem=1 http://139.2.165.14/mms2legacy/downloadMedia2.do?

    In php you would wrap all of this within the system() command. If you put this in a loop where it checks through each email, you should be able to collect a nice cache of images which you could then email on using commands such as php’s mail() method.

    Unfortunately, this is where I stop as I have asked my webhosts to upgrade wget to something which can handle the –post-data flag. However, it should give anybody a head start into this sort of thing. For people using Orange phones, I think you have the same problem but I have yet to investigate it. As for other networks I might get round to you :)

    Anyhow, as for now I hope this is of use to somebody. I would actually love it if flickr themselves put it inside their system if O2 don’t see sense and revert back to emailing people their photos. I shouldn’t have to do this, O2 should see google, amazon, flickr and the BBC opening up their API’s to random people, not for short term profit but to encourage people to play around with new technology. I fear O2 have done this to make people think twice about emailing photos, in an effort to push people into MMSing to other phones, something which costs the earth in the UK at least.

    *the title might be a slight take on a film