Trying to get mailhandler to work with the mycingular image emails.
if i put a line like
drupal_set_message("imap error :" . print_r(imap_mailboxmsginfo($result),TRUE));
just after the open, it says that it sees the messages in there, but doesn't download them, or at least doesn't do anything with them.
Its a little late and i'm wondering if i'm just over looking something obvious. Below is a shortened, de-personalized example of the email it sends.
---------------------------------------------------------------------
Delivered-To: mailblog@.com
Received: by 10.78.150.20 with SMTP id x20cs21152hud;
Tue, 15 May 2007 19:31:10 -0700 (PDT)
Received: by 10.70.9.8 with SMTP id 8mr12693716wxi.1179282668546;
Tue, 15 May 2007 19:31:08 -0700 (PDT)
Return-Path:
Received: from atlmtaow01.cingularme.com (atlmtaow01.cingularme.com [66.102.165.6])
by mx.google.com with ESMTP id h38si957521wxd.2007.05.15.19.31.08;
Tue, 15 May 2007 19:31:08 -0700 (PDT)
Received-SPF: neutral (google.com: 66.102.165.6 is neither permitted nor denied by domain of SOMENUMBER@mms.mycingular.com)
X-Mms-MMS-Version: 18
Date: Tue, 15 May 2007 22:31:07 -0400
X-Nokia-Ag-Internal: ; smiltype=true; internaldate=1179282667516
Content-Type: multipart/mixed; boundary="----=_Part_5693193_1995048.1179282667547"
X-Mms-Delivery-Report: 1
Received: from alpagw01 ([209.183.34.196]) by atlmtaow01.cingularme.com (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20070516023107.FDOF2343.atlmtaow01.cingularme.com@alpagw01> for ; Tue, 15 May 2007 22:31:07 -0400
X-Mms-Transaction-ID: 3388271433.988901491
From:
To: mailblog@SOMEDOMAIN.com
X-Mms-Read-Reply: 1
Mime-Version: 1.0
Message-ID: <15136204.1179282667547.JavaMail.wluser@alpagw01>
X-Mms-Message-Type: 0
Subject: Multimedia message
X-Nokia-Ag-Version: 2.0
------=_Part_5693193_1995048.1179282667547
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
Content-ID: <0_0.jpg>
Content-Location: Photo0014.jpg
Content-Disposition: inline
/9j/4RTbRXhpZgAATU0AKgAAAAgACQEPAAIAAAAUAAAAegEQAAIAAAAEQTcwNwESAAMAAAABAAEA
AAEaAAUAAAABAAAAjgEbAAUAAAABAAAAlgEoAAMAAAABAAIAAAExAAIAAAAZAAAAngITAAMAAAAB
AAEAAIdpAAQAAAABAAAAuAAAAhBTYW1zdW5nIEVsZWN0cm9uaWNzAAAAAEgAAAABAAAASAAAAAFN
<<<>>>
51/OqSZz1KsWtGf/2Q==
------=_Part_5693193_1995048.1179282667547--
---------------------------------------------------------------------
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | mime_and_empty.patch | 5.03 KB | Stuart Greenfield |
Comments
Comment #1
draco2002 commentedSent an example message to the provided test address. Hopefully we can figure this one out.
Comment #2
Stuart Greenfield commentedI am guessing that this message has been posted against mailhandler, but relates to a message being processed via mailhandler and mailsave (I have a MyCingular message in my test mailbox that I just discovered and that has never been processed).
I ran some quick tests and the problem seems to be that the message doesn't contain any text part, so when mailhandler retrieves the message it thinks it is empty, and doesn't bother with any further processing. Mailsave never even gets the message.
If I alter mailhandler to NOT reject on the basis of empty text then the message arrives, the image is processed, and I get a nice picture of a cat!
So the "error" arises because the MMS format fools mailhandler. Mailsave can't interact with mailhandler in a way to intercept this, so the fix, if one were to be done, would need to go in mailhandler.
Thinking out loud, if mailhandler tried to retrieve the text part, but also collected any mime parts, could it then test for empty messages by looking to see if there is nothing at all (no text, no attachments) so the message is truly empty?
Comment #3
Stuart Greenfield commentedI decided to try the above, and shuffled the mailhandler code so it tries to retrieve the body part, and the mimeparts, and checks if both are empty before deciding it has an empty message, and it seems to work.
However, it would mean that an empty message, with mime parts, could be stored if there was no other module that does something meaningful with the attachment.
I've attached a patch as an example of what I did in case it helps (the patch also includes the mime part decode fix from the related bug report - not sure how to separate the two - still getting the hang of Eclipse!)
Comment #4
moshe weitzman commentedI decided to commit this since hardly anyone works on this module these days. We might as use the contributions that are coming in. Please open issues if this code is broken. All I know is that it is valid PHP.
Comment #5
Stuart Greenfield commentedThat's a shame as I like mailhandler, and have used it since 4.7 to allow family overseas to post photos to our website!
I'm happy to help out as and when I can (especially since my mailsave module won't work without mailhandler!)
If hardly anyone works on it, does that mean there is currently no active work to port to Drupal 6?
Comment #6
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.