mime

Adding an HTML prefix to EMail MIME causes some clients to show empty body

扶醉桌前 提交于 2019-12-02 06:14:09
I'm trying to add an HTML part to an Email - which can be any type of MIME (probably mixed or alternative , we get it raw from GMail). Here's how we currently do it: email_copy = deepcopy(original_email) if 'Content-Type' in original_email: original_email.replace_header('Content-Type', 'multipart/mixed') else: original_email.add_header('Content-Type', 'multipart/mixed') warning_part = [MIMEText(warning_html, 'html', 'UTF-8')] original_email.set_payload(warning_part) original_email.attach(email_copy) The above snippet works well for GMail web client, GMail Android app, Outlook on Mac, etc.

使用MediaExtractor+MediaCodec+MediaMuxer实现视频截取和拼接

…衆ロ難τιáo~ 提交于 2019-12-02 05:53:26
Android中使用MediaExtractor+MediaCodec+MediaMuxer实现将本地视频解码截取再和另外的视频进行拼接编码合成一个视频,主要有两个类。 下面是解码相关的类VideoDecoder.java package com . audiovideo . camera . decoder ; import android . media . MediaCodec ; import android . media . MediaCodecInfo ; import android . media . MediaCodecList ; import android . media . MediaExtractor ; import android . media . MediaFormat ; import android . os . Handler ; import android . os . HandlerThread ; import android . support . annotation . NonNull ; import android . util . Log ; import android . widget . Toast ; import com . audiovideo . camera . MyApplication ;

Python Emailing Multipart with body content

对着背影说爱祢 提交于 2019-12-02 04:35:22
问题 I can't send an e-mail in python with a body as a multipart email. Everything I've tried has resulted in all of the content as attachments, and I can't get the text or html to show up in the body. msg = MIMEMultipart() if msg_mime_type == 'text' or not msg_mime_type: new_body = MIMEText(body, 'text') elif msg_mime_type == 'image': new_body = MIMEImage(body) elif msg_mime_type == 'html': new_body = MIMEText(body, 'html') new_body.add_header('Content-Disposition', 'inline', filename='body') msg

Java mailto to MIME

故事扮演 提交于 2019-12-02 04:15:07
Looking for a Java library to convert a mailto link to a MIME message, or at least fill in the parts of it that are contained within the mailto link. Only solution I've found (an SO question) involves use of Desktop which I'm pretty sure my application cannot depend on (highly concurrent, running on a web server). As far as I can tell something simple does not exist. The following code worked using the Uri class from Android, which was not complicated to excise from the Android libraries: MailTo mailTo = MailTo.parse(unsubscribeUrl); Map<String, String> headers = mailTo.getHeaders(); Set<Map

Email subject MIME encoding in Perl.

…衆ロ難τιáo~ 提交于 2019-12-02 02:56:10
I am trying to send an email with non-ASCII characters in the subject line under Perl 5.8.5. My simple example uses the word "Änderungen" (German umlaut), but instead of correctly converting the "Ä" the subject line will always turn out as "Ã?nderungen". #!/usr/bin/env perl use warnings; use strict; use Encode qw(decode encode); my $subject = "Änderungen"; my $subject_encoded = encode("MIME-Q", $subject); [...] open(MAIL, "| /usr/sbin/sendmail -n -t $recipient") || return "ERROR"; print MAIL 'Content-Type: text/plain; charset="utf-8"\n'; print MAIL "To: $recipient\n"; print MAIL "From: $from\n

How to convert Quoted-Print String

心已入冬 提交于 2019-12-02 02:25:05
问题 I'm working on French String in .NET Decoding a Mail body , I receive "Chasn=C3=A9 sur illet" I would like to get "Chasné sur illet" and i don't find any solution aver 2 days web search. C# ou VB.NET Can anyone helps me ? thanks 回答1: Or the easiest of all, just use the QuotedPrintableDecoder from my MimeKit library: static string DecodeQuotedPrintable (string input, string charset) { var decoder = new QuotedPrintableDecoder (); var buffer = Encoding.ASCII.GetBytes (input); var output = new

How can I get the mime type in PHP

折月煮酒 提交于 2019-12-02 01:07:12
I am writing a script and I need to correctly (I think some mime types can be different from their extensions) get the mime types of files (the files can be of any type). Web hosting company in use does not have mime_content_type() and is still (don't know which year they will be fixing it) promising to fix the PECL alternative. Which other way can I go about it (and I don;t have access to shell commands)? You could try finfo_file - it returns the mime type. http://php.net/manual/en/book.fileinfo.php I use the following function, which is a wrapper for the 3 most common methods: function Mime(

malformed email subject header when subject > 75 chars using codeigniter email lib

穿精又带淫゛_ 提交于 2019-12-01 20:10:45
I'm getting some garble in my MIME headers when the subject is over 75 chars. When the line break is encoded in the header there is an extra line break that is invalid. Some email gateways are bouncing the email with a "Malformed MIME field: ?= =?utf-8?Q?SUBJECT?=" error. Does anyone have any experience with utf-8 problems sending emails with CodeIgniter? -snip- Return-Path: *** Subject: =?utf-8?Q?SUBJECT_LINE <-- ?= <-- Problem in Subject header =?utf-8?Q?SUBECT_LINE_2?= <-- To: *** Reply-To: *** -snip- Update: This has nothing to do with gmail smtp. I have rewritten the question in the hope

Setting Return-Path with Python sendmail for a MIME message

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 20:03:25
Hi would like to set the "Return-Path" header for a MIME message I send with Python. Basically, I tried something like this : message = MIMEMultipart() message.add_header("Return-Path", "something@something.com") #... smtplib.SMTP().sendmail(from, to, message.as_string()) The message I receive have its "Return-Path" header set to the same content as the "From" one, even if I explicitly add "Return-Path" header. How can I set "Return-Path" header for a MIME message sent through smtplib's sendmail in Python ? Thanks in advance. Return-Path is set by the SMTP protocol, it's not derived from the

Adding MimeMap via WIX failed

徘徊边缘 提交于 2019-12-01 19:11:40
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:WebSite Id="DefaultWebSite" Description="Default Web Site"> <iis:WebAddress Id="AllUnassigned" Port="80" /> <iis:MimeMap Id="registerXapMimeType" Extension=".xap" Type="application/x-silverlight-app"/> </iis:WebSite> Any idea to why this MIME type was not mapped? I'm