没有smtp服务器啊
smtp.hotmail.com要是能用的邮件服务器
smtp.hotmail.com要是能用的邮件服务器
解决方案 »
- Struts2文件可以上传了取得到图片名,但取不到图片,求帮下忙………
- 一个数字顺序问题。。大虾们看看吧
- ssh框架整合利用 getHibernateTemplate().find(hql)抛异常
- Struts 上传问题 (急) (在线等)
- java新手--怎么找不到JavaServer Web Development Kit 下载,是下载j2ee吗
- 关于分大类再分小类,然后在小类下面显示信息的,高手看下
- 使用struts时,提示NoClassDefFoundError错误
- 怎样把数据库的datetime型数据正确的显示出来?
- 怎么解决ResultSet can not re-read row data for column12??
- 关于sqlserver数据库存储的欧元符号€
- 大家有没有网站提供铃声音,图片下载的一些方法或方案,请高手赐教.
- 怎么实现,在选择第一个下拉框后,第二个下拉框出现与其对应的数据??
你换一个你平时收发邮件的smtp服务器试试。
听说javamail的还没有支持http的,是么??那请问yahoo.com.cn是用的什么啊??我只有hotmail的与yahoo.com.cn的~行么?
出现这种情况怎么办??
我已经有验证代码了啊~Sending failed; nested exception is: class javax.mail.MessagingException: 553 You are not authorized to send mail as >, authentication is required Transport transport = mailSession.getTransport("smtp");
transport.connect("smtp.tom.com","tyflyfish","我的密码");
transport.send(msg,msg.getAllRecipients());
<%@ page contentType="text/html;charset=GB2312" %>
<%request.setCharacterEncoding("gb2312");%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>发送成功</title>
</head>
<body>
<%
try{
//从html表单中获取邮件信息
String tto=(String)request.getParameter("mail");//发信人
String ttitle=(String)request.getParameter("caption");//标题
String tcontent=(String)request.getParameter("body");//内容Properties props=new Properties();//也可用Properties props = System.getProperties();
props.put("mail.smtp.host","smtp.21cn.com");//存储发送邮件服务器的信息
props.put("mail.smtp.auth","true");//同时通过验证
Session s=Session.getInstance(props);//根据属性新建一个邮件会话
s.setDebug(true);MimeMessage message=new MimeMessage(s);//由邮件会话新建一个消息对象//设置邮件
InternetAddress from=new InternetAddress("[email protected]");
message.setFrom(from);//设置发件人
InternetAddress to=new InternetAddress(tto);
message.setRecipient(Message.RecipientType.TO,to);//设置收件人,并设置其接收类型为TO
message.setSubject(ttitle);//设置主题
message.setText(tcontent);//设置信件内容
message.setSentDate(new Date());//设置发信时间//发送邮件
message.saveChanges();//存储邮件信息
Transport transport=s.getTransport("smtp");
transport.connect("smtp.21cn.com","crhwan","guowen1984");//以smtp方式登录邮箱
transport.sendMessage(message,message.getAllRecipients());//发送邮件,其中第二个参数是所有
//已设好的收件人地址
transport.close();%>
<div align="center">
<p><font color="#FF6600">发送成功!</font></p>
<br>
</div>
<%
}catch(MessagingException e){
out.println(e.toString());
}
%>
</body>
</html>