mime

Python email lib - How to remove attachment from existing message?

I have an email that I'm reading with the Python email lib that I need to modify the attachments of. The email Message class has the "attach" method, but does not have anything like "detach". How can I remove an attachment from a multipart message? If possible, I want to do this without recreating the message from scratch. Essentially I...

How do you get the icon, MIME type, and application associated with a file in the Linux Desktop?

Using C++ on the Linux desktop, what is the best way to get the icon, the document description and the application "associated" with an arbitrary file/file path? I'd like to use the most "canonical" way to find icons, mime-type/file type descriptions and associated applications on both KDE and gnome and I'd like to avoid any "shelling ...

creating a MIME email template with images to send with python / django

In my web application I send emails occasionally using a reusable mailer application like this: user - self.user subject = ("My subject") from = "[email protected]" message = render_to_string("welcomeEmail/welcome.eml", { "user" : user, }) send_mail(subject, message, from, [email], priority="high" ) I wa...

Add missing final boundary of HTTP request with Apache / PHP?

Hello, I receive HTTP Post requests from an application, which is already deployed on mobile phones. This application worked fine the last months, but now PHP started complaining with respect to a POST file upload: UPLOAD_ERR_PARTIAL via HTTP 1.0 and PHP5. (After a crash the server had been set up again with new Apache and PHP versions,...

How can I prevent user-agents from presenting a download window for unrecognized mime types?

If you set the Content-Disposition header to attachment, this causes user-agents to always present a download window for that file. I would like to do this opposite of this: force user-agents to always display the response directly. In this particular case, I have an API that's sending JSON. I'd like to serve it as application/json as...

Are there .NET Framework methods to parse an email (MIME)?

Is there a class or set of functions built into the .NET Framework (3.5+) to parse raw emails (MIME documents)? I am not looking for anything fancy or a separate library, it needs to be built-in. I'm going to be using this in some unit tests and need only grab the main headers of interest (To, From, Subject) along with the body (which ...

Methods for limiting the Rails render format to html

I have a Rails 2.1.2 site that only has html templates e.g. jobs.html.erb, so when I request a restful resource: www.mysite.com/jobs/1 It renders my job in html, however, if I request: www.mysite.com/jobs/1.xml I get the error: Template is missing Missing template jobs/show.xml.erb in view path c:/workspace/mysite/app...

What do I need to do to serve an XPI file from IIS7.5.7600 (Win 7 x64) w/ .net and have Firefox know what to do with it?

I've added this to my web.config (IIS did it for me actually): <system.webServer> <staticContent> <mimeMap fileExtension=".xpi" mimeType="application/x-xpinstall" /> </staticContent> </system.webServer> But I still just get a standard file download box. What else is there that I'm missing? ...

How does the Mac OS X Finder recognize a PNG file?

I have a file which was originally named 'foo' in the Finder. If I 'get info' for the file, the Finder recognizes it as "Kind: Plain text". If I rename the file as 'foo.png', Finder then recognizes it as "Kind: Portable Network Graphics image". If I rename the file as 'foo', Finder still recognizes it as "Kind: Portable Networks Graph...

Adding MimeMap via WIX failed.

I've been given a bug to fix an installer issue. Unfortunately, I know nothing about WIX, so I am not exactly where to start. The WXS file is adding the necessary MimeMap, but when QA installed our app on Windows 2003 with IIS6, the MIME type was not set. I am not sure where to start. We are using Wix 3.0. Here is the XML: <iis:Web...

Teaching javax.mail, javax.activation to recognize mime type of mail attachment in web application

Im sending mails from a web application running on a glassfish server, which was quite easy with the java mail API. I'm starting now to attach files (mainly pdf and odt) to the mail, which works to, but the mime type of the attachment is not correctly set (application/octet-stream). I tried to attach the file with: MimeBodyPart mimeBod...

alternative to file(1) for javascript/css mimetype

On win32 I'm using $ file -v file-5.03 magic file from C:\PROGRA~1\gnuwin32/share/misc/magic but its giving weird results foo.css; text/x-c; charset=utf-8 json2.js; text/x-c; charset=us-ascii foo.js; text/x-c++; charset=utf-8 bar.js; text/plain; charset=utf-8 Anyone get similar results? better results? Does anyone know of an altern...

How to serve multipart/related content in PHP?

Say, I have an application/xhtml+xml content and a gif image. How can I serve (not render) these two in a single http get request (using PHP)? It should be a multipart/related content. After reading this RFC, I tried something; but it did not work. (No, I am not trying to send emails with attachment) Thanks in advance. EDIT: Finally I ...

Parsing X-amf mime type data

I have intercepted x-amf data being posted to a website from my computer by a flash application. I have the collected POST data in hex form. While some of it has translated directly to text, the rest is showing wierd symbols which probably means they're flash objects. How do I parse this data to get meaningful output outta it? Basically...

Why is the From line not working on my mail function?

I am using a mail function to send html to an email address, but the From name and email address aren't showing up. This is my code: $name = $_POST['name']; $mailTo = '[email protected]'; $subject = 'Message from ' . $_POST['name']; $message = '<html> <head> <title>HTML email</title> </head> <body> <p><...

Replace System.Net.Mail.MailMessage with manually created message and send it

I am trying to send emails that will bounce to a known mailbox. I plan to use VERP. Unfortunately the System.Net.Mail.MailMessage object does not allow me to precisely set the From: and Sender: headers within my email - it forces the values so that the resulting email contains the phrase 'on behalf of', and does not allow me fine contr...

How can I send MIME data with an email using c# aspx

I want to send a password email to a user, however the customer wants an image embedded (inline) in the email. I created an email, saved the data to a txt file, during my code I read in the template but when I send it the line endings are broken and therefore the MIME data is broken. I just get =3D What am I doing wrong? string F...

mime type for text file through xslt

I just want to know that what is the MIME type i need to give if i am generating text file from xml using xslt? ...

asp.net mvc: check content type of the uploaded file 'text/plain' or 'text/csv', I always get application/octet-stream instead

I want to verify the type of the uploaded file, that's how I do it: [AcceptVerbs(HttpVerbs.Post)] public ViewResult GetDataFromFile() { var file = Request.Files.Get(0); ... if (file.ContentType != "text/csv") { ModelState.AddModelError("FileInput.File", "The file uplo...

How can I set global mime-types for IIS6 programmatically?

Currently I am able to to set a mime type with adsutil.vbs for the primary web site on IIS6 with the following syntax: cscript adsutil.vbs set W3SVC/1/Root/MimeMap ".manifest, text/cache-manifest" This seems to work fine when I only need to target W3SVC/1. I need to write an update script that will make sure that any sites on a given...