可能是SMTP 服务认证不通过
解决方案 »
- 为什么这个椭圆Button在移动的时候椭圆背景会消失???代码如下,急救啊??
- 问大家一个问题,什么叫迭代器?
- java读写xml文件是哪个开发包
- axis部署不了
- 哪位达人帮忙看看这个程序错在哪里了!(50分求解)
- Vector和ArrayList、LinkedList、Hashtable哪个效率更高?
- 请问关于classpath的问题。一本java书上看到过关于:<%JDK%>\Lib\Ext 目录的介绍:此目录会自动加入到classpath环境变量中(不用明确的设
- 初级问题
- 关于时间相减的问题?
- 刚刚学java。用VJ++这个工具,我想知道还有什么可视化的开发工具?那个比较常用。
- 学java用什么编译器,集成开发工具?
- 谁能帮我看看程序有什么问题吗?
You are attempting to send email to a domain that is not recognized by this server
You are attempting to relay email through this server, and have not authenticated
Most likely you are seeing this message because you have not authenticated. To use this server as a relay (to send email to an outside address using your domain name), you must authenticate first. You can do this in one of two ways:
SMTP Authentication - SMTP AUTH is a method for verifying a user's login and password before allowing Mail to be sent to other Mail Servers on the Internet. Your Email Client is required to login before sending mail. This method allows you to simply enter your Username and Password (the same ones you use for POP or IMAP) in the SMTP settings in your email program.
POP before Send - This method allows you to simply check your email before sending. Once you have checked your email, you are allowed to relay for the next 15 minutes from your current IP address without further authentication.
这是因为你使用的smtp服务器加了认证,你必须拥有该服务器上合法的用户名和密码才能使用该服务器的smtp服务。
你要修改以下你的方法
props.put("mail.smtp.host", "smtp.sina.com.cn");
props.put("mail.smtp.auth", "true");。
transport.connect("smtp.sina.com.cn", "name","password")
Sending failed;
nested exception is:
javax.mail.AuthenticationFailedException
Properties props = new Properties();
props.put("mail.host", host);// Setup authentication, get session
Authenticator auth = new PopupAuthenticator();
Session session = Session.getInstance(
props, auth);// Get the store
Store store = session.getStore("pop3");
store.connect();Then, you would need to create a PopupAuthenticator class that extends Authenticator. In the public PasswordAuthentication getPasswordAuthentication() method, the class would pop a frame up prompting for username and password, returning the information in a PasswordAuthentication object.