★
★蓝天★
Unregistered / Unconfirmed
GUEST, unregistred user!
我想用javamail发邮件,应该也已经配置好了,从书上抄了一锻,但是为什么会出错呢?有谁能不能把你们写邮件的代码贴出来呢?还有就是邮件群发的问题,不知道该怎么办啊?
<%@ page import="java.text.*"%>
<%@ page import="javax.mail.*" %>
<%@ page import="javax.mail.internet.*" %>
<%@ page import="javax.activation.*" %>
<%
Properties props=new Properties();
props.put("mail.smtp.host","smtp.citiz.net");
Session s=Session.getInstance(props);
MimeMessage message=new MimeMessage(s);
InternetAddress from=new InternetAddress("aaa@citiz.net");
message.setFrom(from);
InternetAddress to=new InternetAddress("bbb@citiz.net");
message.addRecipient(Message.RecipientType.To,to);//这一句有错,他说RecipientType没有方法To,
message.setSubject("Test from JavaMail.");
message.setText("hello from javamail");
Store store=s.getStore("pop3");
store.connect("pop.citiz.net","aaa","password");
Transport.send(message);
store.close();
%>
<%@ page import="java.text.*"%>
<%@ page import="javax.mail.*" %>
<%@ page import="javax.mail.internet.*" %>
<%@ page import="javax.activation.*" %>
<%
Properties props=new Properties();
props.put("mail.smtp.host","smtp.citiz.net");
Session s=Session.getInstance(props);
MimeMessage message=new MimeMessage(s);
InternetAddress from=new InternetAddress("aaa@citiz.net");
message.setFrom(from);
InternetAddress to=new InternetAddress("bbb@citiz.net");
message.addRecipient(Message.RecipientType.To,to);//这一句有错,他说RecipientType没有方法To,
message.setSubject("Test from JavaMail.");
message.setText("hello from javamail");
Store store=s.getStore("pop3");
store.connect("pop.citiz.net","aaa","password");
Transport.send(message);
store.close();
%>