473,394 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

tale of two attachments

TBS
Hi,

I have a script that is invoked by .forward on a Unix mailbox.

It works fine parsing an attachment and saving to disk when the email
is sent directly to the email address (header 1), but doesn't work
when the email is sent via a majordomo mailing list (header 2). I've
looked at the mime files coming into mail, and they look the same.
I've attached the headers, and I don't see any major different,
although there is a warning on the mailing list that "X-Authentication-
Warning: lists...: pmx set sender to owner-list-report@... using -f".

Here is the code fragment, it seems to fail on the second header on
the part.get_param call:

parser=email.Parser.Parser()
msg = parser.parsestr(raw_email)
counter = 1
for part in msg.walk():
if part.get_main_type()== 'multipart':
continue
log.write("gets here") #gets to this point for
majordomo send
filename = part.get_param("name")
log.write("...but not here") #but not to this point
if filename==None:
filename = "part-%1" % counter
counter += 1
fp = open(os.path.join(dir, filename), 'wb')
fp.write(part.get_payload(decode=1))
fp.close()

=============================
Header 1
=============================
From tshab@... Mon Jul 7 11:00:46 2008
Received: from nospam3...
by mail... with ESMTP id m67I0jSg023687
for <direct@...; Mon, 7 Jul 2008 11:00:45 -0700 (PDT)
(envelope-from tshab@whatever)
Received: from exch-mail...
by nospam... with ESMTP id m67I0jfd014416
for <direct@whatever>; Mon, 7 Jul 2008 11:00:45 -0700 (PDT)
(envelope-from tshab@...)
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: application/vnd.ms-excel;
name="po_test.xls"
Content-Transfer-Encoding: base64
Content-Description: po_test.xls
Content-Disposition: attachment;
filename="po_test.xls"
Subject: test case
Date: Mon, 7 Jul 2008 11:00:44 -0700
Message-ID: <CFF3D7191F21B44FA906AAE979C66AEA022AFACC@...>
In-Reply-To: <CFF3D7191F21B44FA906AAE979C66AEA022AFACB@...>
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
Thread-Topic: test case
thread-index: AcjgWxsfx8N1mNqFSOq9C/j/8FIZIQAADqBg
References: <CFF3D7191F21B44FA906AAE979C66AEA022AFACB@exch-mail...>
From: "Shab, Theodore" <tshab@...>
To: "arf" <direct@...>
Content-Length: 18675
Status: RO

=============================
Header 2
=============================

From owner-list-report@... Mon Jul 7 11:01:05 2008
Received: from list... (list...)
by mail with ESMTP id m67I14uL023715;
Mon, 7 Jul 2008 11:01:04 -0700 (PDT)
(envelope-from owner-list-report@...)
Received: from lists...
by list... with ESMTP id m67I13bD017476
for <list-report-outgoing@...>; Mon, 7 Jul 2008 11:01:03 -0700 (PDT)
(envelope-from owner-list-report@...)
Received: (from pmx@localhost)
by list.../Submit) id m67I13lG017475
for list-report-outgoing; Mon, 7 Jul 2008 11:01:03 -0700 (PDT)
(envelope-from owner-list-report@...)
X-Authentication-Warning: lists...: pmx set sender to owner-list-
report@... using -f
Received: from nospam... (nospam...)
by lists... with ESMTP id m67I127h017471
for <list-report@...>; Mon, 7 Jul 2008 11:01:02 -0700 (PDT)
(envelope-from tshab@...)
Received: from exch-mai...)
by nospam... with ESMTP id m67I11g2014193
for <list-report@...>; Mon, 7 Jul 2008 11:01:02 -0700
(envelope-from tshab@...)
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: application/vnd.ms-excel;
name="po_test.xls"
Content-Transfer-Encoding: base64
Content-Description: po_test.xls
Content-Disposition: attachment;
filename="po_test.xls"
Subject: test case 2
Date: Mon, 7 Jul 2008 11:01:01 -0700
Message-ID: <CFF3D7191F21B44FA906AAE979C66AEA022AFACD@...>
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
Thread-Topic: test case 2
thread-index: AcjgW2qv6AWa1eUxTXGlSQ5a2g7OuA==
From: "Shab, Theodore" <tshab@...>
To: "list-report" <list-report@...>
Sender: owner-list-report@...
Precedence: bulk
Content-Length: 18675
Status: O

Jul 7 '08 #1
0 680

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: S_p_ike | last post by:
Hi all, I have a problem with mail with attachments. To send e-mail with attachments from a form, I use Setec Astronomy's libmail class (v 1.4) (available here http://www.phpclasses.org/) ...
1
by: Trond A. S. Andersen | last post by:
Hi all, I'm working on a project in which i need to send mail attachments in the form of Excel documents from a .NET C# application. I've written a class which creates the Excel document using...
1
by: nabil m | last post by:
hi i have 5 checkboxes i would like to when the user click on 1 or multiple checkbox i would like to email 1 or multiple files attachments to them ex: mailMsg.Attachments.Add(myAttachment+i); but...
5
by: Jozef | last post by:
Hello, I have an Access XP database that has attachments to a BE database that has a password. The attachments work fine, until I run some code that modifies a BE table (adding a field). I do...
2
by: Brad | last post by:
I have a web .Net app which sends emails with attachments. After the email is sent I clean up aftermyself and delete the attachments from disk. In upgrading to .Net 2 I changed the email logic...
1
by: mike11d11 | last post by:
If someone could help me, I need to be able to send attachments from my access database that I have created. This database runs queries then generates a report off the queries from underlying...
0
by: bambi | last post by:
I am facing issues while adding attachments in an E-mail via Mapisend. The code I use is below. If I try to send , I am getting error messgae in Mailmessage.12. Mailmessage.12 is expected as numeric,...
1
by: Steve Holden | last post by:
I'm having some trouble getting attachments right for all recipients, and it seems like Apple's mail.app is the pickiest client at the moment. It doesn't handle attachments that both Thunderbird...
130
by: Gianni Mariani | last post by:
Attached example CPP files makes it easier to post code and extract code from posts. It's unimaginable at this time where virtually any news reader is capable of dealing with attachments to stick...
1
by: budyerr | last post by:
All, I am trying to build a email submission form using asp.net. I currently have a web form page that will upload to my webhosting server, attach to email then delete the file after sending. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.