mime

reading body part of a mime multipart

本秂侑毒 提交于 2019-11-29 09:16:26
ok so I use .getcontent and receive javax.mail.internet.MimeMultipart@fd13b5 etc. I know i need something like this in my code but i dont know what exactly is needed. if (p.isMimeType("text/plain")) { pr("This is plain text"); pr("---------------------------"); if (!showStructure && !saveAttachments) System.out.println((String)p.getContent()); } else if (p.isMimeType("multipart/*")) { pr("This is a Multipart"); pr("---------------------------"); Multipart mp = (Multipart)p.getContent(); level++; int count = mp.getCount(); for (int i = 0; i < count; i++) dumpPart(mp.getBodyPart(i)); level--; }

Mime-type of downloading file

偶尔善良 提交于 2019-11-29 08:47:22
i'm trying to create downloadable video-files. In my site there is a list of files. All videos are in .flv-format (flash). There is exact link to the file for the all videos. But in all browsers after clicking content is loading to the browser`s window. I needn't in this. As i understand i should create redirect-page wich contains mime-type of the download file. What exactly should i do? Language: php Create a PHP page with the following: <?php $filepath = "path/to/file.ext"; header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment;

PHP mail formatting issue - Why do CRLF header line endings break HTML email in Outlook?

江枫思渺然 提交于 2019-11-29 08:41:51
I'm using the PHP native mail() function to send HTML emails and have a formatting problem in the users most common email client - Outlook 2007 ( in addition to some other email clients ) - all the html tags are exposed so it looks like gibberish to a non-web-developer. I'm sending HTML email the same way that the PHP manual demos it. Example: $message = get_HTML_email_with_valid_formatting(); $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; $headers .= "From: example.com <info@example.com>\r\n"; $headers .= "Reply-To: donotreply@example.com\r\n";

ServletContext对象

烈酒焚心 提交于 2019-11-29 06:37:34
ServletContext对象,代表了整个web应用,可以和程序的容器(服务器)来通信 获取方式 通过request对象获取: request.getServletContext() 通过HttpServlet获取: this.getServletContext(); ServletContext对象的功能 获取MIME类型(文后将什么是MIME类型): String getMimeType(String file) 获取到数据的类型后,可以 用于设置响应头content-type 的值 获取方法: String getMimeType(String file); 域对象:共享数据,前面说到,ServletContext代表了整个web应用, 因此ServletContext对象中存放的数据整个web应用的资源都可以访问和修改 方法 和request域对象的三个方法一样,只是两者的作用范围不同 获取文件的真实(服务器)路径 方法:String getRealPath(String path) 文件直接位于web目录下时: context.getRealPath("/+文件名称"); 文件位于web目录下下的目录a中时: context.getRealPath("/a/+文件名称"); 文件直接位于src目录下时: context.getRealPath("/WEB-INF

Canvas保存纹理到图片

北城余情 提交于 2019-11-29 06:04:17
var MIME_TYPE = "image/png"; var imgURL = canvas.toDataURL(MIME_TYPE); var dlLink = document.createElement('a'); dlLink.download = "d://image"+Math.random()+".png"; dlLink.href = imgURL; dlLink.dataset.downloadurl = [MIME_TYPE, dlLink.download, dlLink.href].join(':'); document.body.appendChild(dlLink); dlLink.click(); document.body.removeChild(dlLink); 如上代码,可以打印canvas内容到图片,但是canvas可以为div对象,也可以为canvas对象。 来源: https://www.cnblogs.com/minnong/p/11458164.html

How to send multi-part MIME messages in c#?

倖福魔咒の 提交于 2019-11-29 01:18:06
I want to send multi-part MIME messages with an HTML component plus a plain text component for people whose email clients can't handle HTML. The System.Net.Mail.MailMessage class doesn't appear to support this. How do you do it? D'oh, this is really simple... but I'll leave the answer here for anyone who, like me, came looking on SO for the answer before Googling... :) Credit to this article . Use AlternateViews , like so: //create the mail message var mail = new MailMessage(); //set the addresses mail.From = new MailAddress("me@mycompany.com"); mail.To.Add("you@yourcompany.com"); //set the

Add mime type to HTML link

僤鯓⒐⒋嵵緔 提交于 2019-11-29 01:01:42
I know how to change the MIME type in a webserver. I used this to make sure the browser downloads my .scrpt file instead of opening the plain text version. So far so good but is it possible to do the same with a link? I would like to link to a file on GitHub but this will open as a plain text file. Can I add a "MIME type attribute" to the link to tell the browser to download the file? This is what I would like to see: <a mimetype="application/octet-stream" href="http://gist.github.com/raw/279094/39d5a2c1037288d5ee0ba1a17dca9edb368bbe42/RepairiPhotoDates.scpt">download</a> Time to answer my own

Jersey: A message body writer for Java Class and MIME mediatype application/json was not found

有些话、适合烂在心里 提交于 2019-11-28 23:05:18
after trying to figure out what's my problem I finally decided to ask you how to solve my problem. I've seen different people with the same problem and I tried all the things they were adviced to do but nothing helped with my issue. So basically I'm having a RESTful Service which I build using Jersey. For my client I would like to return an object in JSON Format. I read through different tutorials and decided that it makes sense to use jersey-json-1.8 library. I added everything to my project as usual and tried to run it but each time I'm calling the service (via get request atm.) I'm getting

S/MIME——邮件安全守护者

狂风中的少年 提交于 2019-11-28 21:55:09
在过去的二十几年里,电子邮件由于其成本低、效率高的特性,已经成为世界领先的通信媒体之一,其速度甚至超过了电话和传统的邮件服务。 近年来,邮件安全问题日益突出,电子邮件很容易成为被黑客瞄准的目标,沦为诈骗、勒索软件攻击的重灾区。攻击的手段也更加高明。恶意邮件的占比屡创新高,邮件泄密事件可谓是层出不穷,其颠覆性的鱼叉式钓鱼攻击软件甚至企图干涉2016年美国总统大选。 美国邮件门回顾 希拉里在担任国务卿期间,使用私人电子邮箱和位于家中的私人服务器收发大量涉密邮件。2016年夏季,美国民主党全国委员会、筹款委员会、竞选团队被黑客组织入侵,近2万封邮件被维基解密披露。邮件显示,希拉里涉嫌抹黑竞争对手,以及可能涉嫌洗钱等财务问题。最终,希拉里因“邮件门”最终落败美国总统竞选。 威胁种类 虽然电子邮件的安全经常被看作是一个独立的问题,实际上它是几种不同威胁的混合物,这些威胁都可以单独地破坏计算机及欺诈收件人,而且可以损害邮件的有效性、可靠性及人们对邮件系统的信任。电子邮件威胁可被分为几种不同的种类: 名称 威胁 病毒、蠕虫、特洛伊木马 三种罪大恶极的恶意代码可以作为电子邮件附件诱使用户打开或运行,它们就可以破坏一台主机系统的数据,将计算机变成可被远程控制的网络僵尸,甚至可以导致收件人经济上的巨大损失。 网络钓鱼 钓鱼攻击可以利用社交网络工程窃取个人的信息和财务金融数据。这种攻击主要依赖“伪造

java+web+批量下载文件

帅比萌擦擦* 提交于 2019-11-28 19:59:48
JavaWeb 文件下载功能 文件下载的实质就是文件拷贝,将文件从服务器端拷贝到浏览器端,所以文件下载需要IO技术将服务器端的文件读取到,然后写到response缓冲区中,然后再下载到个人客户端。 1. 文件名 - 接受前端发来的文件名 获取到前端页面发送过来的要下载的文件的名字 String filenameValue = req.getParameter("filename"); 2. ServletContext域 - 获取到ServletContext域对象 后面将调用此对象的一系列方法,用于获取文件路径、文件MimeType,并设置文件输出类型 ServletContext servletContext = req.getServletContext(); //获取到ServletContext域对象 3. 文件路径 - 获取指定文件在web项目中的路径 通过获取到ServletContext域对象的getRealPath()方法,读取download目录下文件的绝对路径 注意:download目录必须放在webContent目录下面,否则可能会找不到,导致报异常,在读取资源的时候,项目demo会直接去查找webContent下面的文件和文件夹 String realPath = servletContext.getRealPath("download/"