Search code examples
codeigniteremailformatmms

MMS with CodeIgniter email class


I'm currently working on an application that will send the user a selected coupon via email or MMS. The problem that I am running into is with the display of the MMS when the customer receives it. on Android, the image is being displayed as a video, and on iOS, everything is wrong about the message.

Here's an example of the headers that are being sent:

User-Agent: none
Date: Tue, 5 Mar 2013 10:45:12 -0500
From: 
Return-Path: 
Subject: =?utf-8?Q?Your_Requested_Coupon?=
To: ##########@txt.att.net
Reply-To: "webadministrator@domain.com" 
X-Sender: webadministrator@domain.com
X-Mailer: none
X-Priority: 3 (Normal)
Message-ID: <51361308f1651@domain.com>
Mime-Version: 1.0


Content-Type: multipart/mixed; boundary="B_ATC_51361309002f2"

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ATC_51361309002f2
Content-Type: multipart/alternative; boundary="B_ALT_51361308f3595"

--B_ALT_51361308f3595
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit




--B_ALT_51361308f3595
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable



--B_ALT_51361308f3595--

--B_ATC_51361309002f2
Content-type: image/jpeg; name="promo3.jpg"
Content-Disposition: attachment;
Content-Transfer-Encoding: base64

....
IMAGE ENCODING HERE
....

--B_ATC_51361309002f2--

And the CI Code:

$this->email->from('webadministrator@domain.com');
$this->email->to('XXXXXXXXXX@PHONE_MESSAGE_CENTER.COM');
$this->email->subject('Your Requested Coupon');
$this->email->message($this->load->view('sms_email', '', TRUE));
$this->email->attach('/path/to/image.jpg'); //I've also tried passing a second param 'inline' to change the Content-Disposition to inline

Does anyone know if it is possible to use the built in email class to accomplish this, or do I need to write specific headers to make picture messaging display properly?

Also is there a proper message format for MMS: text or html?, is there a proper way to attach an image for the iOS to view?


Solution

  • trying to send mms from the web using an email address, example @mms.att.com, will get you blocked by the network eventually. there is not a clean way to get around this problem without support of the network or mms partner. the best solution these days is to just send an sms with a link to a mobile ad on the web.

    and by the way, i'd recommend a provider like cdyne or twilio for sms (dont try to send sms via email address either!) you might also try to simply connect a 3g/4g modem and modifying the driver to programmatically shoot sms/mms messages. go at your own risk on that one ..