看你可怜的,好,我来帮你一把:
<%@ page contentType="text/html; charset=GBK" import="javax.mail.*,javax.mail.event.*,javax.mail.internet.*,java.util.*" %>
<%
Properties props = new Properties();
props.put("mail.smtp.host","smtp.mail.yahoo.com");
Session s = Session.getInstance(props);
MimeMessage message = new MimeMessage(s);InternetAddress from  = new InternetAddress("[email protected]");
message.setFrom(from);
InternetAddress to = new InternetAddress("[email protected]");
message.addRecipient(Message.RecipientType.TO,to);message.setSubject("Test from JavaMail.");
message.setText("Hello from JavaMail!");Store store = s.getStore("pop3");
store.connect("pop.mail.yahoo.com","yahooUsername","yahooPassword");
Transport.send(message);
store.close();
%>
<html>
<head>
<title>
testjavamail
</title>
</head>
<body bgcolor="#ffffff">
<p>test javamail</p>
</body>
</html>