最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
使用ESMTP(SMTP)进行邮件发送
时间:2022-07-02 18:10:16 编辑:袖梨 来源:一聚教程网
使用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
假如附件为图片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
相关文章
- QQ经典版下载安装最新版-QQ经典版轻量版app官方正式版下载 12-17
- 豆包网页版官方入口-豆包网页版一键直达官网 12-17
- 抖音网页版官方入口-在线畅玩douyin.com 12-17
- 土豪漫画官方下载入口-安卓/iOS一键安装APP 12-17
- QQ经典版最新版本下载安装-QQ经典版app官方正版下载地址 12-17
- 漫蛙官网入口网页直达-漫蛙官网入口官方认证链接 12-17