From: "Robert P. J. Day" on

i *think* i know the answer to this, but i'll ask anyway so i don't
go wandering off down the wrong path.

i just go an android phone, and i'm testing creating messages with
the Mail and Mail_mime packages and sending them to my phone via my
carrier's MMS gateway.

i can, from my regular e-mail account (this one), email with an
attachment to my phone, and it shows up fine. however, when i use the
PEAR classes to create a MIME message and send it to my phone, it
appears to arrive but asks that i download the attachment, which it
then fails to do.

i took those two emails (the one that worked, and the one that
didn't), ran them both thru mimedecode and the major difference seems
to be that the one that worked had the attachment with a content
disposition of "inline", while the one that failed had "attachment",
so i'm *guessing* that's the critical difference.

as i read it, i can't set the content disposition simply with the
Mail_mime class, i need Mail_mimePart, correct?

rday
--

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================
From: "Robert P. J. Day" on
On Fri, 12 Mar 2010, Robert P. J. Day wrote:

> i *think* i know the answer to this, but i'll ask anyway so i
> don't go wandering off down the wrong path.
>
> i just go an android phone, and i'm testing creating messages with
> the Mail and Mail_mime packages and sending them to my phone via my
> carrier's MMS gateway.
>
> i can, from my regular e-mail account (this one), email with an
> attachment to my phone, and it shows up fine. however, when i use
> the PEAR classes to create a MIME message and send it to my phone,
> it appears to arrive but asks that i download the attachment, which
> it then fails to do.
>
> i took those two emails (the one that worked, and the one that
> didn't), ran them both thru mimedecode and the major difference
> seems to be that the one that worked had the attachment with a
> content disposition of "inline", while the one that failed had
> "attachment", so i'm *guessing* that's the critical difference.
>
> as i read it, i can't set the content disposition simply with the
> Mail_mime class, i need Mail_mimePart, correct?

ok, maybe i *don't* quite know how this is going to work, so here's
what i've got so far. my original attempt (that failed) looked like
this:

=====
.... snip ...

$headers['From'] = $from;
$headers['Subject'] = $subject;

$mime = new Mail_mime(array('text_charset' => 'UTF-8; format=flowed'));
$mime->setTXTBody($msg);
$mime->addAttachment($filename, $filetype);

$body = $mime->get();
$headers = $mime->headers($headers);

$msg = &Mail::factory('smtp', ... etc etc ...);
$msg->send($to, $headers, $body);
=====

that did send off the msg, but the alleged attachment wasn't visible
or downloadable at the receiving phone end and, as i said, the problem
*seems* to be that i need to make that file inline instead of
attachment.

so how would i modify the above? can i preserve most of it and
simply replace the addAttachment() part? or must i rewrite the whole
thing using mime parts? from what i see in the PEAR documentation, it
looks like i need to rewrite the whole script using mime parts for
even the plain text body, is that correct? if someone has a working
version of this, i'd be delighted to see it.

rday

p.s. have i, in fact, identified the problem? is the issue the
difference between that file being an attachment as opposed to being
inline? this would seem to be a fairly important issue since it's the
difference between sending a mime message through my carrier's MMS
gateway and whether that send succeeds or fails.

--


========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================