最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
javamail通过pop3收信,附件下载,我的办法(代码!)
时间:2022-07-02 18:12:18 编辑:袖梨 来源:一聚教程网
从附件名连接到这个servlet!
DownloadServlet.java
package MailServlet;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;
/**
*
*
*
*
* @author simon
* @version 1.0
*/
public class DownloadServlet extends HttpServlet
{
public void service(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
HttpSession session = request.getSession();
String contentType = request.getParameter("contenttype"); //附件的ContentType
int count = Integer.parseInt(request.getParameter("count")); //第几个BodyPart
Object body = session.getAttribute("body"); //邮件的MimeMultipart
if(body != null)
{
System.out.println("download Start!");
try
{
MimeMultipart mp = (MimeMultipart)body;
int i = mp.getCount();
DownloadServlet.java
package MailServlet;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;
/**
*
Title:
*
Description:
*
Copyright: Copyright (c) 2002
*
Company: Socix
* @author simon
* @version 1.0
*/
public class DownloadServlet extends HttpServlet
{
public void service(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
HttpSession session = request.getSession();
String contentType = request.getParameter("contenttype"); //附件的ContentType
int count = Integer.parseInt(request.getParameter("count")); //第几个BodyPart
Object body = session.getAttribute("body"); //邮件的MimeMultipart
if(body != null)
{
System.out.println("download Start!");
try
{
MimeMultipart mp = (MimeMultipart)body;
int i = mp.getCount();
相关文章
- 戒断反应是什么梗 04-17
- 女神异闻录夜幕魅影家园怎么玩 04-17
- 射雕手游红尘戏俗乐之问成就怎么达成 04-17
- 欢乐钓鱼大师樱飘雪怎么钓 04-17
- 女神异闻录夜幕魅影俱乐部三层要怎么走 04-17
- 逆水寒手游肯德基联动系列武器一览 04-17