使用ESMTP/SMTP进行邮件发送,遇到一个问题:
假如附件为图片gif文件,发送没有问题。但是接收后,无法显示图片。敬请高手指点!!!!!
/*
* Created on 2004-12-21
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class FoxMailMain {
public static void main(String[] args) {
FoxMail foxMail = new FoxMail("smtp.citiz.net",25);
foxMail.setMailUserName("zhou");
foxMail.setMailUserPass("abcdefgf");
foxMail.setMailTo("
[email protected]");
foxMail.setMailFrom("
[email protected]");
foxMail.setMailShowTo("tom");
foxMail.setMailShowFrom("Nike");
foxMail.setMailSubject("hello用中文主题");
foxMail.setMailBody("welcome for you. mmm.中文呀.aaa
载来一行");
foxMail.setMailAttachFile(new String[] {"D:eclipse_projectworkspacePROJECT_emailsrcpic.gif"});
if(foxMail.sendMail()){
System.out.println("OK.");
}else{
System.out.println("False.");
}
}
}
FoxMail.java 代码
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/*
* Created on 2004-12-21
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author Administrator