主题:发送邮件问题
请问各位:以下代码哪里有问题..为什么老是报
无效的用户名
Properties p = new Properties();
p.put("mail.transport.protocol", "smtp");
p.put("mail.smtp.host", "smtp.sohu.com");
p.put("mail.smtp.port", "25");
Session session = Session.getInstance(p);
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("wangwu@sohu.com")); //发件人
message.setRecipient(Message.RecipientType.TO,
new InternetAddress("zhaoliu23@163.net")); //收件人
message.setSentDate(new Date());
message.setSubject("subject");
message.setText("laila ,qing la de ");
Transport.send(message);
System.out.println("邮件发送成功");
无效的用户名
Properties p = new Properties();
p.put("mail.transport.protocol", "smtp");
p.put("mail.smtp.host", "smtp.sohu.com");
p.put("mail.smtp.port", "25");
Session session = Session.getInstance(p);
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("wangwu@sohu.com")); //发件人
message.setRecipient(Message.RecipientType.TO,
new InternetAddress("zhaoliu23@163.net")); //收件人
message.setSentDate(new Date());
message.setSubject("subject");
message.setText("laila ,qing la de ");
Transport.send(message);
System.out.println("邮件发送成功");