Sending (SMS) Picture Messages With ColdFusion And CFMail

Posted June 25, 2007 at 7:20 AM

Tags: ColdFusion

A while back, I talked about sending text messages (SMS messages) to mobile phones using ColdFusion and CFMail. Well, walking down the street today, surrounding by young woman in scantily clad summer outfits, I wondered if the same could be done with picture messages (PIX Messages). At first, I tried to send a picture to my VText email address using ColdFusion's CFMailParam tag (sending the picture as an attachment). The message went through to my phone, but only as text message.

After some Googling, I found out that several phone carriers allow you to send email-based SMS picture messages, but these require different email addresses than the SMS text messages. For Verizon, my cellular carrier, text messages get send to NUMBER@vtext.com, but PIX messages need to be sent to NUMBER@vzwpix.com. Here are the SMS picture message emails for some of the more popular carriers:

AT&T Wireless

NUMBER@mmode.com

Cingular

NUMBER@mms.mycingular.com

Sprint

NUMBER@pm.sprint.com

T-Mobile

NUMBER@tmomail.net

Verizon

NUMBER@vzwpix.com

Equip with this new knowledge, sending the PIX message was quite easy:

 Launch code in new window » Download code as text file »

  • <!---
  • Send the pix message. This will send the text
  • message in the CFMailPart in addition to the image.
  • --->
  • <cfmail
  • to="5555555555@vzwpix.com"
  • from="ben@xxxxxxxx.com"
  • subject="Have fun at CFUNITED!">
  •  
  • <!--- Send text message. --->
  • <cfmailpart type="text/plain">Have Fun!</cfmailpart>
  •  
  • <!--- Send image as attachment. --->
  • <cfmailparam
  • file="#ExpandPath( './beach_girls_640_480_at_30.jpg' )#"
  • type="image/jpg"
  • />
  •  
  • </cfmail>

PIX messages can send both a picture and a text message at the same time. In the above code, notice that I am using the CFMailPart to sent the text message in addition to the CFMailParam tag to send the image as an attachment. I, of course, can only test this on Verizon Wireless, but I assume the technology is pretty uniform across the different carriers.

If you look at the image that I am attaching, you might have noticed that it contains "640_480" and ends with "at_30". The first part is the image dimensions that I am using. My LG Verizon cell phone can handle image dimensions up to 640 x 480 pixels. To maximize the image quality, I am going to use the largest dimensions possible. The ending part of the file name, "at_30", is the JPEG compression that I was using. Compression is a funny thing when it comes to cell phones; it's counterintuitive. Normally, a 30 compression is horrible! Look at the beach girls image at quality-30 compression at normal size:


 
 
 

 
 Beach Girls At 30 Quality Compression  
 
 
 

As you can see, this compression has taken something beautiful and made it ugly. Your gut tells you to use something more standard, like a quality-80 compression:


 
 
 

 
 Beach Girls At 80 Quality Compression  
 
 
 

Clearly, a much nicer and more satisfying image. But, what we forget is that most cell phones (unless you have one of those really nice ones) have crap resolutions; image quality is really poor no matter what. In fact, when I send a 30 and an 80 quality compression image to my cell phone, they look exactly the same. The only difference becomes file size. The 30-quality image above is 12 Kb. The 80-quality image is a whopping 53 Kb. And, since most cell phones have limited storage capacity, you are going to want to optimize file size as much as possible.

Just a final note, PIX messages are much more expensive than text messages (not for any sort of technology reasons - just cause they say so), so don't go crazy emailing images to people.

Download Code Snippet ZIP File

Post Comment  |  Ask Ben  |  Permalink  |  Other Searches  |  Print Page





Reader Comments

Jun 25, 2007 at 10:10 AM // reply »
1 Comments

Me and my girlfriends are never going to the beach with again. How dare you post our pic on the web. BTW, we really had a good time especially back at the bungalow.


Dec 3, 2007 at 3:50 PM // reply »
1 Comments

So I tryed number@vzwpix.com and it doesn't work anymore.


Dec 3, 2007 at 3:54 PM // reply »
6,516 Comments

That's lame. Stupid cellular carriers with their restrictions. Why can't they just let us use their service, no hassles.


nad
Mar 3, 2009 at 7:07 AM // reply »
1 Comments

sweet


Sep 10, 2009 at 1:30 PM // reply »
1 Comments

the number@vzwpix.com does work


Sep 12, 2009 at 10:09 PM // reply »
6,516 Comments

@Josh,

It's possible that the number has been changed; it's also possible that is being blocked however you are trying to do it.


Post Comment  |  Ask Ben

Recent Blog Comments
Nov 22, 2009 at 1:56 AM
Learning ColdFusion 9: Using CFQuery In CFScript Can Enable SQL Injection Attacks
Why adobe would give you script equivalent of cfquery is beyond me. I love cfquery tag because it helps me wriite clean sql, and get away from the horrible jdbc queries If I wanted to write javali ... read »
Nov 22, 2009 at 1:45 AM
Streaming Text Using ColdFusion's CFContent Tag And The Variable Attribute
The reason you would want to do this is to stream. Ack json/xml files to ria clients I used thus technique before because putting json in response stream causes debugging info to come thru As well a ... read »
Nov 21, 2009 at 6:47 PM
Hal Helms - Real World Object Oriented Development, Sarasota - Day Five
@charlie griefer, Thank you.. ... read »
Nov 21, 2009 at 5:15 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jose Galdamez, Oh heh yeah I didn't paste the whole code. I should have defined the vars -- my bad. It's fixed thou. Thanks. ... read »
Nov 21, 2009 at 4:49 PM
Styling The ColdFusion 8 WriteToBrowser CFImage Output
Great work yet again Ben! Whilst I didn't use this whole code, I copied some of your regex code for a similar problem with the lack of an alt attribute and unescaped ampersands in CFIMAGE for Railo 3 ... read »
Nov 21, 2009 at 1:13 PM
My First ColdFusion Builder Extension - Encrypting And Decrypting CFM / CFC Files
@Ben, Because I am pedantic, I just want to make sure that everyone knows there is absolutely no encryption going on. There is only encoding and obfuscation. The cfencode tool only obfuscates your C ... read »
Nov 21, 2009 at 12:28 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jody I can't seem to get your code sample to work. If you are still having problems, try this code out and see if it gets you what you wanted. <!--- Comma delimited list with various duplicates ... read »
Nov 21, 2009 at 11:03 AM
Groovy Operator Overloading Does Not Work In The ColdFusion Context
Hi Ben, Thanks for this informative post. Now I am reading ur old posts too ... read »