<a herf="mailto:[email protected]">his mail</a>
不知道是不是你的意思
不知道是不是你的意思
解决方案 »
- 异常处理问题
- 用Java来获取访问者真实的IP地址
- java excel 导出
- 如果一字符串内容为"true && false || true",那如何得到其含义(值)为boolean 的ture?
- 求助:一个小程序(小弟太穷了,麻烦大侠们免费帮个忙,狂谢!)
- java中的多线程不太理解
- 关于java开发?
- 系统蓝屏
- 谁有类似bugbase的工具,用于公司内部开发测试的交流协调。
- 那位大哥有java 的jdk 开发文档 。可以告诉我能在那找到么?(最好是中文的。谢谢)
- 关于JAVA的环境问题?各位高手
- 我现在用JBUILDER3在开发上落不落伍,也就是说,对于新型的应用,jbuilder3支持到什么程度?
new MouseAdapter(){
public void mouseEntered(MouseEvent me){
//在这里加入产生下划线的代码。
}
public void mouseClicked(MouseEvent me){
//调用javamail
}
});//大概就是这样的
//java mail depends on http://java.sun.com/products/javabeans/glasgow/jaf.html
//Set your CLASSPATH to include the "mail.jar" file obtained from
// the download, as well as the current directory.
//
// Assuming you unzipped javamail-1_2.zip in c:\download the
// following would work:
//
// set CLASSPATH=%CLASSPATH%;c:\download\javamail-1.2\mail.jar;.
//
// Also include the "activation.jar" file that you obtained from
// downloading the JavaBeans Activation Framework, in your CLASSPATH.
//
// set CLASSPATH=%CLASSPATH%;c:\download\activation\activation.jar
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.UnsupportedEncodingException;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;public class Mail extends JFrame
{
JLabel jlSendMail = new JLabel("Send Mail");
public Mail()
{
this.getContentPane().setLayout(new FlowLayout());
this.getContentPane().add(jlSendMail);
jlSendMail.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent me)
{
try{
String host = "smtp.21cn.com";//"Mail Server in your Company";
String from = "[email protected]";//"From Email";
String to = "[email protected]";//"To Email";
Properties props = new Properties();
Session session;
//Store store;
Transport transport;
props.put("mail.smtp.host", host);
session = Session.getInstance(props, null);
//session.setDebug(true);
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(from,"Ahmad"));
message.setRecipient(Message.RecipientType.TO, new InternetAddress(to,"Ahmadwa"));
message.setSubject("First");
//message.setSentDate(new Date());
message.setText("Hi Emad" + (char)(10) + "How are you? This is a test mail send by java program"+new Date());
transport = session.getTransport("smtp");
transport.send(message);
System.out.println("Your Mail Send Successfully");
}
catch (MessagingException e) {System.out.println("1)" + e.toString());}
catch (UnsupportedEncodingException e) {System.out.println("2)" + e.toString());}
}
});
this.setSize(600,600);
this.setVisible(true);
}
public static void main(String args[])
{
new Mail();
}
}