mime

Why doesn't this mail message decode correctly?

风流意气都作罢 提交于 2019-12-09 01:15:33
问题 I have this code. It's from the Zend Reading Mail example. $message = $mail->getMessage(1); // output first text/plain part $foundPart = null; foreach (new RecursiveIteratorIterator($mail->getMessage(1)) as $part) { try { if (strtok($part->contentType, ';') == 'text/plain') { $foundPart = $part; break; } } catch (Zend_Mail_Exception $e) { // ignore } } if (!$foundPart) { echo 'no plain text part found'; } else { echo $foundPart->getContent(); } What I can get is the message, that works fine.

MultipartEntityBuilder to send pictures to rail server

若如初见. 提交于 2019-12-08 19:44:10
问题 I am trying to send a MultipartEntityBuilder to my Rails server. However when i try to build it it crashes and gives me the error 03-25 09:44:50.001 W/System.err﹕ java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: No static method create(Ljava/lang/String;[Lorg/apache/http/NameValuePair;)Lorg/apache/http/entity/ContentType; in class Lorg/apache/http/entity/ContentType; or its super classes (declaration of 'org.apache.http.entity.ContentType HttpPost httpost = new HttpPost

Get Content Type of Request

喜欢而已 提交于 2019-12-08 14:32:25
问题 To find the incoming content type, docs say: request.headers["Content-Type"] # => "text/plain" But I found by trial-and-error, that doesn't work, but this does: request.headers["CONTENT_TYPE"]=='application/json' So what's the most robust+portable way to do it? 回答1: I would usually go for request.format and request.content_type for reading these header fields. EDIT : found a bit more on this that might help: https://stackoverflow.com/a/1595453/624590 回答2: You don't need to parse the content

VUE中将页面导出为图片或者PDF

假如想象 提交于 2019-12-08 13:10:35
导出为图片 1.将页面html转换成图片 npm install html2canvas --save 2.在需要导出的页面引入 import html2canvas from 'html2canvas'; 3.在 methods 中添加方法 dataURLToBlob(dataurl) {//ie 图片转格式 var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); while (n--) { u8arr[n] = bstr.charCodeAt(n); } return new Blob([u8arr], {type: mime}) }, downloadResult(name) { let canvasID = document.body let a = document.createElement('a'); html2canvas(canvasID).then(canvas => { let dom = document.body.appendChild(canvas); dom.style.display = "none"; a.style.display = "none

How to send MIME over HTTP?

為{幸葍}努か 提交于 2019-12-08 11:00:03
问题 I need to send certain data to the server in a .zip archive, over HTTP POST request, MIME encoded. I take it that means only that I need to specify MIME type in a request header. But I'm confused as to what should I put in request's body. So far I can see two ways to do it: Usually, as I take it (sorry, I'm not a web coder, so kinda lame with HTTP), POST request body consists of pairs parameter_name=some+data divided by '&'. Should I do it the same way and write contents of my file in base64

HTTP Header Mime Type in Websphere Application Server 7

只谈情不闲聊 提交于 2019-12-08 09:36:38
问题 I have a Spring Web Application where a user can download PDF and Excel Files. I set the HTTP header for both of them: HttpHeaders responseHeaders = new HttpHeaders(); responseHeaders.setContentType(MediaType.parseMediaType("application/vnd.ms-excel")); responseHeaders.setContentLength(fileSize); responseHeaders.set("Content-Disposition", "attachment"); responseHeaders.add("Content-Disposition", "filename=\"" + encodedFileName + '\"'); This works fine on Tomcat (the HTTP response is of mime

MP4 content type returned as different MIME type in different browsers

跟風遠走 提交于 2019-12-08 09:06:31
问题 I have an ASP.NET application built using C# for the backend. I have a form that uploads a pdf and checks the MIME type, application/pdf, to verify it's a valid file. I need to do this on a seperate form for MP4 files but it didn't seem to work. It always returned false. I checked the returned MIME type FileUpload.PostedFile.ContentType in webkit which was perfectly accurate. Firefox 5 and IE 8, however, tested for text/csv and application/octet-stream, respectively. This makes absolutely no

Is it possible to embed an inline image in HTML email using MFMailComposeViewController?

纵然是瞬间 提交于 2019-12-08 06:31:51
问题 Is it possible to embed a reference to an image in an HTML email sent via MFMailComposeViewController on iPhone OS 3.0? (void)addAttachmentData:(NSData*)attachment mimeType:(NSString*)mimeType fileName:(NSString*)filename doesn't seem to provide any way of either setting or reading the Content-ID header for an attachment, but is there some way to make this work? I have seen apps that do this, but they're probably using SKPSMTPMessage... 回答1: I believe you can use an HTML tag in the email's

Javascript not being rendered at script but as html instead

巧了我就是萌 提交于 2019-12-08 06:29:28
This question is to piggy back off of a previous one I asked yesterday , which deals with moving the create/edit feature of a model onto its index page. One last issue I am having is that I when I go to delete a model, I have some javascript that is supposed to run that reloads the list of models to reflect the change in the database. This js is being rendered as html. Here is the code that I think is relevant: in my controller: def destroy @post = Post.find(params[:id]) @post.destroy flash[:notice] = "Successfully destroyed post." @posts = Post.all respond_to do |format| format.js {render

Problems using multipart_encode (poster library)

我怕爱的太早我们不能终老 提交于 2019-12-08 06:15:23
问题 I am trying to upload a file using multipart_encode to realize the MIME process. However, I met the following error AttributeError: multipart_yielder instance has no attribute '__len__' . Below are is my approach, I really appreciate if anyone can give me some suggestions. url = "https://pi-user-files.s3-external-1.amazonaws.com/" post_data = {} #data is a dict post_data['AWSAccessKeyId']=(data['ticket']['AWSAccessKeyId']) post_data['success_action_redirect']=(data['ticket']['success_action