- 浏览: 20452 次
- 性别:
- 来自: 武汉
文章分类
最新评论
package coffeecatwebmail;
import java.io.*;
import java.text.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public class PRaseMimeMessage{
private MimeMessage mimeMessage = null;
private String saveAttachPath = ""; //附件下载后的存放目录
private StringBuffer bodytext = new StringBuffer(); //存放邮件内容的StringBuffer对象
private String dateformat = "yy-MM-dd HH:mm"; //默认的日前显示格式
/**
* 构造函数,初始化一个MimeMessage对象
*/
public PraseMimeMessage(){}
public PraseMimeMessage(MimeMessage mimeMessage){
this.mimeMessage = mimeMessage;
System.out.println("create a PraseMimeMessage object........");
}
public void setMimeMessage(MimeMessage mimeMessage){
this.mimeMessage = mimeMessage;
}
/**
* 获得发件人的地址和姓名
*/
public String getFrom()throws Exception{
InternetAddress address[] = (InternetAddress[])mimeMessage.getFrom();
String from = address[0].getAddress();
if(from == null) from="";
String personal = address[0].getPersonal();
if(personal == null) personal="";
String fromaddr = personal+"<"+from+">";
return fromaddr;
}
/**
* 获得邮件的收件人,抄送,和密送的地址和姓名,根据所传递的参数的不同
* "to"----收件人 "cc"---抄送人地址 "bcc"---密送人地址
*/
public String getMailAddress(String type)throws Exception{
String mailaddr = "";
String addtype = type.toUpperCase();
InternetAddress []address = null;
if(addtype.equals("TO") || addtype.equals("CC") ||addtype.equals("BCC")){
if(addtype.equals("TO")){
address = (InternetAddress[])mimeMessage.getRecipients(Message.RecipientType.TO);
}else if(addtype.equals("CC")){
address = (InternetAddress[])mimeMessage.getRecipients(Message.RecipientType.CC);
}else{
address = (InternetAddress[])mimeMessage.getRecipients(Message.RecipientType.BCC);
}
if(address != null){
for(int i=0;i String email=address[i].getAddress();
if(email==null) email="";
else{
email=MimeUtility.decodeText(email);
}
String personal=address[i].getPersonal();
if(personal==null) personal="";
else{
personal=MimeUtility.decodeText(personal);
}
String compositeto=personal+"<"+email+">";
mailaddr+=","+compositeto;
}
mailaddr=mailaddr.substring(1);
}
}else{
throw new Exception("Error emailaddr type!");
}
return mailaddr;
}
/**
* 获得邮件主题
*/
public String getSubject()throws MessagingException{
String subject = "";
try{
subject = MimeUtility.decodeText(mimeMessage.getSubject());
if(subject == null) subject="";
}catch(Exception exce){
}
return subject;
}
/**
* 获得邮件发送日期
*/
public String getSentDate()throws Exception{
Date sentdate = mimeMessage.getSentDate();
SimpleDateFormat format = new SimpleDateFormat(dateformat);
return format.format(sentdate);
}
/**
* 获得邮件正文内容
*/
public String getBodyText(){
return bodytext.toString();
}
/**
* 解析邮件,把得到的邮件内容保存到一个StringBuffer对象中,解析邮件
* 主要是根据MimeType类型的不同执行不同的操作,一步一步的解析
*/
public void getMailContent(Part part)throws Exception{
String contenttype = part.getContentType();
int nameindex = contenttype.indexOf("name");
boolean conname =false;
if(nameindex != -1) conname=true;
System.out.println("CONTENTTYPE: "+contenttype);
if(part.isMimeType("text/plain") %26amp;%26amp; !conname){
bodytext.append((String)part.getContent());
}else if(part.isMimeType("text/html") %26amp;%26amp; !conname){
bodytext.append((String)part.getContent());
}else if(part.isMimeType("multipart/*")){
Multipart multipart = (Multipart)part.getContent();
int counts = multipart.getCount();
for(int i=0;i getMailContent(multipart.getBodyPart(i));
}
}else if(part.isMimeType("message/rfc822")){
getMailContent((Part)part.getContent());
}else{}
}
/**
* 判断此邮件是否需要回执,如果需要回执返回"true",否则返回"false"
*/
public boolean getReplySign()throws MessagingException{
boolean replysign = false;
String needreply[] = mimeMessage.getHeader("Disposition-Notification-To");
if(needreply != null){
replysign = true;
}
return replysign;
}
/**
* 获得此邮件的Message-ID
*/
public String getMessageId()throws MessagingException{
return mimeMessage.getMessageID();
}
/**
* 【判断此邮件是否已读,如果未读返回返回false,反之返回true】
*/
public boolean isNew()throws MessagingException{
boolean isnew = false;
Flags flags = ((Message)mimeMessage).getFlags();
Flags.Flag []flag = flags.getSystemFlags();
System.out.println("flagss length: "+flag.length);
for(int i=0;i if(flag[i] == Flags.Flag.SEEN){
isnew=true;
System.out.println("seen Message.......");
break;
}
}
return isnew;
}
/**
* 判断此邮件是否包含附件
*/
public boolean isContainAttach(Part part)throws Exception{
boolean attachflag = false;
String contentType = part.getContentType();
if(part.isMimeType("multipart/*")){
Multipart mp = (Multipart)part.getContent();
for(int i=0;i BodyPart mpart = mp.getBodyPart(i);
String disposition = mpart.getDisposition();
if((disposition != null) %26amp;%26amp;((disposition.equals(Part.ATTACHMENT)) ||(disposition.equals(Part.INLINE))))
attachflag = true;
else if(mpart.isMimeType("multipart/*")){
attachflag = isContainAttach((Part)mpart);
}else{
String contype = mpart.getContentType();
if(contype.toLowerCase().indexOf("application") != -1) attachflag=true;
if(contype.toLowerCase().indexOf("name") != -1) attachflag=true;
}
}
}else if(part.isMimeType("message/rfc822")){
attachflag = isContainAttach((Part)part.getContent());
}
return attachflag;
}
/**
* 【保存附件】
*/
public void saveAttachMent(Part part)throws Exception{
String fileName = "";
if(part.isMimeType("multipart/*")){
Multipart mp = (Multipart)part.getContent();
for(int i=0;i BodyPart mpart = mp.getBodyPart(i);
String disposition = mpart.getDisposition();
if((disposition != null) %26amp;%26amp;((disposition.equals(Part.ATTACHMENT)) ||(disposition.equals(Part.INLINE)))){
fileName = mpart.getFileName();
if(fileName.toLowerCase().indexOf("gb2312") != -1){
fileName = MimeUtility.decodeText(fileName);
}
saveFile(fileName,mpart.getInputStream());
}else if(mpart.isMimeType("multipart/*")){
saveAttachMent(mpart);
}else{
fileName = mpart.getFileName();
if((fileName != null) %26amp;%26amp; (fileName.toLowerCase().indexOf("GB2312") != -1)){
fileName=MimeUtility.decodeText(fileName);
saveFile(fileName,mpart.getInputStream());
}
}
}
}else if(part.isMimeType("message/rfc822")){
saveAttachMent((Part)part.getContent());
}
}
/**
* 【设置附件存放路径】
*/
public void setAttachPath(String attachpath){
this.saveAttachPath = attachpath;
}
/**
* 【设置日期显示格式】
*/
public void setDateFormat(String format)throws Exception{
this.dateformat = format;
}
/**
* 【获得附件存放路径】
*/
public String getAttachPath(){
return saveAttachPath;
}
/**
* 【真正的保存附件到指定目录里】
*/
private void saveFile(String fileName,InputStream in)throws Exception{
String osName = System.getProperty("os.name");
String storedir = getAttachPath();
String separator = "";
if(osName == null) osName="";
if(osName.toLowerCase().indexOf("win") != -1){
separator = "\\"
if(storedir == null || storedir.equals("")) storedir="c:\\tmp";
}else{
separator = "/";
storedir = "/tmp";
}
File storefile = new File(storedir+separator+fileName);
System.out.println("storefiles path: "+storefile.toString());
//for(int i=0;storefile.exists();i++){
//storefile = new File(storedir+separator+fileName+i);
//}
BufferedOutputStream bos = null;
BufferedInputStream bis = null;
try{
bos = new BufferedOutputStream(new FileOutputStream(storefile));
bis = new BufferedInputStream(in);
int c;
while((c=bis.read()) != -1){
bos.write(c);
bos.flush();
}
}catch(Exception exception){
exception.printStackTrace();
throw new Exception("文件保存失败!");
}finally{
bos.close();
bis.close();
}
}
/**
* PraseMimeMessage类测试
*/
public static void main(String args[])throws Exception{
String host = "主机名/ip"; //【pop.mail.yahoo.com.cn】
String username ="用户名"; //【wwp_1124】
String passWord ="密码"; //【........】
Properties props = new Properties();
session session = Session.getDefaultInstance(props, null);
Store store = session.getStore("pop3");
store.connect(host, username, password);
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);
Message message[] = folder.getMessages();
System.out.println("Messagess length: "+message.length);
PraseMimeMessage pmm = null;
for(int i=0;i pmm = new PraseMimeMessage((MimeMessage)message[i]);
System.out.println("Message "+i+" subject: "+pmm.getSubject());
System.out.println("Message "+i+" sentdate: "+pmm.getSentDate());
System.out.println("Message "+i+" replysign: "+pmm.getReplySign());
System.out.println("Message "+i+" hasRead: "+pmm.isNew());
System.out.println("Message "+i+" containAttachment: "+pmm.isContainAttach((Part)message[i]));
System.out.println("Message "+i+" form: "+pmm.getFrom());
System.out.println("Message "+i+" to: "+pmm.getMailAddress("to"));
System.out.println("Message "+i+" cc: "+pmm.getMailAddress("cc"));
System.out.println("Message "+i+" bcc: "+pmm.getMailAddress("bcc"));
pmm.setDateFormat("yy年MM月dd日 HH:mm");
System.out.println("Message "+i+" sentdate: "+pmm.getSentDate());
System.out.println("Message "+i+" Message-ID: "+pmm.getMessageId());
pmm.getMailContent((Part)message[i]);
System.out.println("Message "+i+" bodycontent: \r\n"+pmm.getBodyText());
pmm.setAttachPath("c:\\tmp\\coffeecat1124");
pmm.saveAttachMent((Part)message[i]);
}
}
}
-------------------------------------------------------------------------------
资料引用:http://www.knowsky.com/341707.html
import java.io.*;
import java.text.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public class PRaseMimeMessage{
private MimeMessage mimeMessage = null;
private String saveAttachPath = ""; //附件下载后的存放目录
private StringBuffer bodytext = new StringBuffer(); //存放邮件内容的StringBuffer对象
private String dateformat = "yy-MM-dd HH:mm"; //默认的日前显示格式
/**
* 构造函数,初始化一个MimeMessage对象
*/
public PraseMimeMessage(){}
public PraseMimeMessage(MimeMessage mimeMessage){
this.mimeMessage = mimeMessage;
System.out.println("create a PraseMimeMessage object........");
}
public void setMimeMessage(MimeMessage mimeMessage){
this.mimeMessage = mimeMessage;
}
/**
* 获得发件人的地址和姓名
*/
public String getFrom()throws Exception{
InternetAddress address[] = (InternetAddress[])mimeMessage.getFrom();
String from = address[0].getAddress();
if(from == null) from="";
String personal = address[0].getPersonal();
if(personal == null) personal="";
String fromaddr = personal+"<"+from+">";
return fromaddr;
}
/**
* 获得邮件的收件人,抄送,和密送的地址和姓名,根据所传递的参数的不同
* "to"----收件人 "cc"---抄送人地址 "bcc"---密送人地址
*/
public String getMailAddress(String type)throws Exception{
String mailaddr = "";
String addtype = type.toUpperCase();
InternetAddress []address = null;
if(addtype.equals("TO") || addtype.equals("CC") ||addtype.equals("BCC")){
if(addtype.equals("TO")){
address = (InternetAddress[])mimeMessage.getRecipients(Message.RecipientType.TO);
}else if(addtype.equals("CC")){
address = (InternetAddress[])mimeMessage.getRecipients(Message.RecipientType.CC);
}else{
address = (InternetAddress[])mimeMessage.getRecipients(Message.RecipientType.BCC);
}
if(address != null){
for(int i=0;i String email=address[i].getAddress();
if(email==null) email="";
else{
email=MimeUtility.decodeText(email);
}
String personal=address[i].getPersonal();
if(personal==null) personal="";
else{
personal=MimeUtility.decodeText(personal);
}
String compositeto=personal+"<"+email+">";
mailaddr+=","+compositeto;
}
mailaddr=mailaddr.substring(1);
}
}else{
throw new Exception("Error emailaddr type!");
}
return mailaddr;
}
/**
* 获得邮件主题
*/
public String getSubject()throws MessagingException{
String subject = "";
try{
subject = MimeUtility.decodeText(mimeMessage.getSubject());
if(subject == null) subject="";
}catch(Exception exce){
}
return subject;
}
/**
* 获得邮件发送日期
*/
public String getSentDate()throws Exception{
Date sentdate = mimeMessage.getSentDate();
SimpleDateFormat format = new SimpleDateFormat(dateformat);
return format.format(sentdate);
}
/**
* 获得邮件正文内容
*/
public String getBodyText(){
return bodytext.toString();
}
/**
* 解析邮件,把得到的邮件内容保存到一个StringBuffer对象中,解析邮件
* 主要是根据MimeType类型的不同执行不同的操作,一步一步的解析
*/
public void getMailContent(Part part)throws Exception{
String contenttype = part.getContentType();
int nameindex = contenttype.indexOf("name");
boolean conname =false;
if(nameindex != -1) conname=true;
System.out.println("CONTENTTYPE: "+contenttype);
if(part.isMimeType("text/plain") %26amp;%26amp; !conname){
bodytext.append((String)part.getContent());
}else if(part.isMimeType("text/html") %26amp;%26amp; !conname){
bodytext.append((String)part.getContent());
}else if(part.isMimeType("multipart/*")){
Multipart multipart = (Multipart)part.getContent();
int counts = multipart.getCount();
for(int i=0;i getMailContent(multipart.getBodyPart(i));
}
}else if(part.isMimeType("message/rfc822")){
getMailContent((Part)part.getContent());
}else{}
}
/**
* 判断此邮件是否需要回执,如果需要回执返回"true",否则返回"false"
*/
public boolean getReplySign()throws MessagingException{
boolean replysign = false;
String needreply[] = mimeMessage.getHeader("Disposition-Notification-To");
if(needreply != null){
replysign = true;
}
return replysign;
}
/**
* 获得此邮件的Message-ID
*/
public String getMessageId()throws MessagingException{
return mimeMessage.getMessageID();
}
/**
* 【判断此邮件是否已读,如果未读返回返回false,反之返回true】
*/
public boolean isNew()throws MessagingException{
boolean isnew = false;
Flags flags = ((Message)mimeMessage).getFlags();
Flags.Flag []flag = flags.getSystemFlags();
System.out.println("flagss length: "+flag.length);
for(int i=0;i if(flag[i] == Flags.Flag.SEEN){
isnew=true;
System.out.println("seen Message.......");
break;
}
}
return isnew;
}
/**
* 判断此邮件是否包含附件
*/
public boolean isContainAttach(Part part)throws Exception{
boolean attachflag = false;
String contentType = part.getContentType();
if(part.isMimeType("multipart/*")){
Multipart mp = (Multipart)part.getContent();
for(int i=0;i BodyPart mpart = mp.getBodyPart(i);
String disposition = mpart.getDisposition();
if((disposition != null) %26amp;%26amp;((disposition.equals(Part.ATTACHMENT)) ||(disposition.equals(Part.INLINE))))
attachflag = true;
else if(mpart.isMimeType("multipart/*")){
attachflag = isContainAttach((Part)mpart);
}else{
String contype = mpart.getContentType();
if(contype.toLowerCase().indexOf("application") != -1) attachflag=true;
if(contype.toLowerCase().indexOf("name") != -1) attachflag=true;
}
}
}else if(part.isMimeType("message/rfc822")){
attachflag = isContainAttach((Part)part.getContent());
}
return attachflag;
}
/**
* 【保存附件】
*/
public void saveAttachMent(Part part)throws Exception{
String fileName = "";
if(part.isMimeType("multipart/*")){
Multipart mp = (Multipart)part.getContent();
for(int i=0;i BodyPart mpart = mp.getBodyPart(i);
String disposition = mpart.getDisposition();
if((disposition != null) %26amp;%26amp;((disposition.equals(Part.ATTACHMENT)) ||(disposition.equals(Part.INLINE)))){
fileName = mpart.getFileName();
if(fileName.toLowerCase().indexOf("gb2312") != -1){
fileName = MimeUtility.decodeText(fileName);
}
saveFile(fileName,mpart.getInputStream());
}else if(mpart.isMimeType("multipart/*")){
saveAttachMent(mpart);
}else{
fileName = mpart.getFileName();
if((fileName != null) %26amp;%26amp; (fileName.toLowerCase().indexOf("GB2312") != -1)){
fileName=MimeUtility.decodeText(fileName);
saveFile(fileName,mpart.getInputStream());
}
}
}
}else if(part.isMimeType("message/rfc822")){
saveAttachMent((Part)part.getContent());
}
}
/**
* 【设置附件存放路径】
*/
public void setAttachPath(String attachpath){
this.saveAttachPath = attachpath;
}
/**
* 【设置日期显示格式】
*/
public void setDateFormat(String format)throws Exception{
this.dateformat = format;
}
/**
* 【获得附件存放路径】
*/
public String getAttachPath(){
return saveAttachPath;
}
/**
* 【真正的保存附件到指定目录里】
*/
private void saveFile(String fileName,InputStream in)throws Exception{
String osName = System.getProperty("os.name");
String storedir = getAttachPath();
String separator = "";
if(osName == null) osName="";
if(osName.toLowerCase().indexOf("win") != -1){
separator = "\\"
if(storedir == null || storedir.equals("")) storedir="c:\\tmp";
}else{
separator = "/";
storedir = "/tmp";
}
File storefile = new File(storedir+separator+fileName);
System.out.println("storefiles path: "+storefile.toString());
//for(int i=0;storefile.exists();i++){
//storefile = new File(storedir+separator+fileName+i);
//}
BufferedOutputStream bos = null;
BufferedInputStream bis = null;
try{
bos = new BufferedOutputStream(new FileOutputStream(storefile));
bis = new BufferedInputStream(in);
int c;
while((c=bis.read()) != -1){
bos.write(c);
bos.flush();
}
}catch(Exception exception){
exception.printStackTrace();
throw new Exception("文件保存失败!");
}finally{
bos.close();
bis.close();
}
}
/**
* PraseMimeMessage类测试
*/
public static void main(String args[])throws Exception{
String host = "主机名/ip"; //【pop.mail.yahoo.com.cn】
String username ="用户名"; //【wwp_1124】
String passWord ="密码"; //【........】
Properties props = new Properties();
session session = Session.getDefaultInstance(props, null);
Store store = session.getStore("pop3");
store.connect(host, username, password);
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);
Message message[] = folder.getMessages();
System.out.println("Messagess length: "+message.length);
PraseMimeMessage pmm = null;
for(int i=0;i pmm = new PraseMimeMessage((MimeMessage)message[i]);
System.out.println("Message "+i+" subject: "+pmm.getSubject());
System.out.println("Message "+i+" sentdate: "+pmm.getSentDate());
System.out.println("Message "+i+" replysign: "+pmm.getReplySign());
System.out.println("Message "+i+" hasRead: "+pmm.isNew());
System.out.println("Message "+i+" containAttachment: "+pmm.isContainAttach((Part)message[i]));
System.out.println("Message "+i+" form: "+pmm.getFrom());
System.out.println("Message "+i+" to: "+pmm.getMailAddress("to"));
System.out.println("Message "+i+" cc: "+pmm.getMailAddress("cc"));
System.out.println("Message "+i+" bcc: "+pmm.getMailAddress("bcc"));
pmm.setDateFormat("yy年MM月dd日 HH:mm");
System.out.println("Message "+i+" sentdate: "+pmm.getSentDate());
System.out.println("Message "+i+" Message-ID: "+pmm.getMessageId());
pmm.getMailContent((Part)message[i]);
System.out.println("Message "+i+" bodycontent: \r\n"+pmm.getBodyText());
pmm.setAttachPath("c:\\tmp\\coffeecat1124");
pmm.saveAttachMent((Part)message[i]);
}
}
}
-------------------------------------------------------------------------------
资料引用:http://www.knowsky.com/341707.html
发表评论
-
pdf生成
2013-05-20 10:40 966pd4ml技术html导出pdf,支持中文,兼容Linux ... -
谷歌验证码
2013-04-09 12:12 957原创随笔】强大的谷歌开源免费验证码reCAPTCHA ... -
读取zip文件
2013-02-27 11:07 666package com.me.admin.test; impo ... -
spring mvc
2013-01-14 17:33 595Spring MVC 框架搭建及详解 您的评价: ... -
实现基于Spring框架应用的权限控制系统
2013-01-02 11:34 718实现基于Spring框架应用 ... -
url重写
2012-11-19 17:26 797>猎头职位: 陕西: 西安:senior java en ... -
获得ip
2012-11-13 16:24 469public class IP { /** * * ... -
怎么修改mysql数据库的密码
2012-11-12 10:01 523GRANT ALL PRIVILEGES ON *.* TO ... -
密码加密
2012-11-08 10:55 478public class MD5 { public stat ... -
自己做的上線的網站
2012-10-09 10:12 600http://www.polyvision.com.hk/ ... -
有用文檔
2012-09-13 18:18 553<pre name="code" c ... -
java中的文件上傳
2012-08-06 14:38 647[Java] Spring2文件上传 ... -
關於java學習的友情鏈接
2012-08-06 14:26 428http://www.g4studio.org/forum-5 ... -
object C
2012-07-27 17:37 586http://www.verycd.com/entrie ... -
Struts2基于注解的Action配置
2012-07-18 16:49 643Struts2基于注解的Action配置 ... -
时间转换的单例模式
2012-07-18 10:21 632/* *时间转换 */ package com.loko ... -
s2s2h3搭建
2012-07-11 18:08 637SSH 环境搭建完整教程 一、SSH ... -
ssh搭建
2012-07-11 18:00 793分享 返回分享首页» 分享 ... -
stuts2配置
2012-07-11 17:49 501struts2环境配置 struts2框架 ... -
转码的方案
2012-07-10 17:48 4Eclipse编码格式修改 2010-07-14 2:54 ...
相关推荐
这个类称为 MailInfo,包含了邮件的各种信息,例如邮件服务器的主机名和端口号、邮件发送者的地址、邮件接收者的地址、邮件主题、邮件内容、邮件附件等。 在 MailInfo 类中,我们定义了多个成员变量,用于存储邮件...
在IT领域,网页发邮件是一种常见的功能,它允许用户通过浏览器界面发送电子邮件,而无需借助桌面邮件客户端。本文将深入探讨如何使用HTML实现这一功能,以及相关的关键技术点。 首先,我们要理解HTML(HyperText ...
在线发邮件系统是一种便捷的工具,它允许用户无需登录邮箱客户端或网页版邮箱,直接通过输入必要的信息(发送邮件的地址、标题和正文)来发送邮件。这种系统通常基于Web技术构建,为用户提供了一个简洁的界面,使得...
发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件的库发送邮件...
本示例“多线程发邮件”就是利用了这一特性,通过并发执行多个邮件发送任务,来加快邮件的发送速度。下面我们将深入探讨相关知识点。 首先,多线程是指在一个进程中同时执行多个线程,这些线程可以共享同一块内存...
### SAP BO 自动发邮件配置指导 #### 一、引言 在企业级应用中,自动化工具能够极大地提高工作效率并减少人为错误。SAP BusinessObjects(简称BO)提供了强大的数据分析和报告工具,其中包括了自动发送电子邮件的...
### Foxmail已发邮件无显示问题解析与解决方法 #### 一、问题概述 在使用Foxmail客户端发送邮件的过程中,可能会遇到一个较为常见的问题:已发送的邮件在“已发送”文件夹中无法正常显示出来。这不仅影响了用户的...
本文将详细介绍如何在服务器已经屏蔽了所有发邮件函数的情况下,依然能够成功发送邮件的方法。 #### 一、问题背景与分析 当一个网站或应用无法正常发送邮件时,这往往会给业务带来较大的影响,例如用户注册验证、...
提供的文件“Jmail发邮件--成功.xls”可能是包含VBA代码的示例Excel工作簿,其中包含了完整的邮件发送功能。你可以打开这个文件,查看并学习如何将上述代码整合进实际的VBA项目中。 总的来说,利用VBA和Jmail控件,...
.net 465端口发送邮件,开发过程中,经常会使用到发送邮件功能,而我们在使用阿里云服务器发送邮件时,由于安全原因,阿里云禁用掉了25端口,于是就造成了我们在本地使用25端口发送邮件时是好的,一放到服务器上就...
这通常通过使用特定的邮件服务或软件实现,这些工具可以隐藏发件人的IP地址和电子邮件地址。匿名发送邮件的主要目的是保护隐私,避免垃圾邮件过滤器,或者在进行敏感通信时提供额外的安全层。然而,值得注意的是,...
总之,使用PowerBuilder结合jmail库发送邮件是一项常见的任务,通过理解PowerBuilder的ActiveX集成和邮件发送协议,开发者可以创建出功能完备的邮件发送功能。同时,对于特定的邮件服务商,如QQ邮箱,需要了解其SMTP...
在Lotus Notes(通常简称Notes)中,定时发送邮件是一项非常实用的功能,它允许用户预先设定邮件内容,并在特定的时间自动发送,无需手动操作。这个功能对于那些需要定期报告、提醒或者通知的情况非常有用。以下将...
标题"perl自动发邮件"表明我们要讨论如何利用Perl编写脚本来创建一个自动发送邮件的程序。Perl提供了多个模块来处理电子邮件的发送,其中最常用的是`Email::Sender`系列模块,如`Email::Sender::Simple`用于基础的...
- SAP中的发件人邮箱设置有两种方式:一种是在`SCOT`中直接设置“DefaultDomain”,另一种则是在需要发送邮件的用户的“远程邮件”栏中填写发件人的邮箱地址。 - 根据实际情况选择适合的方式进行设置。 ##### 6. ...
在发送邮件前,我们需要定义发件人(`MailAddress`)和收件人(`MailAddress`)。 ```csharp MailAddress from = new MailAddress(listPara[0].Replace("\r", "").Trim(), ""); // 发件人邮箱地址 MailAddress to = ...
4. **创建Message对象**:`Message`对象代表邮件本身,使用`MimeMessage`类创建它,并设置发件人、收件人、主题和正文。例如: ```java MimeMessage message = new MimeMessage(session); message.setFrom(new ...
SMTP是互联网标准,用于从发件人邮件服务器传输邮件到收件人邮件服务器。邮件发送.exe可能就是实现SMTP通信的程序,它连接到SMTP服务器,根据Excel中的数据发送邮件。 ICSharpCode.SharpZipLib是一个.NET的压缩库,...
例如,使用PHPMailer,我们首先需要下载并引入库文件,然后设置SMTP服务器信息,创建邮件对象,设置发件人、收件人、主题和内容,最后调用发送方法。 ```php require 'PHPMailer/PHPMailerAutoload.php'; $mail =...