debbicty
debbicty
2009-02-09 13:16

关于javamail发送到本机的问题

  • 企业应用

是我的本机地址错误吗?

public String send1() throws Exception
{
//确定要发送的邮件服务器地址
String mailserver = "liweiqiang";

    try
    {
        //设置邮件的传输协议
        Properties prop = System.getProperties();
        prop.put("mail.smtp.host", mailserver);
        prop.put("mail.smtp.auth","false");   

        //建立邮件发送的连接
        Session s = Session.getDefaultInstance(prop, null);

        //创建发送信息的载体
        Message message = new MimeMessage(s);

        //设置相关的邮件属性
        message.setFrom(new InternetAddress(email.getForm()));
        message.setRecipient(Message.RecipientType.TO, new InternetAddress(email.getTo()));
        message.setSubject(email.getTitle());
        message.setText(email.getContext());

        //发送
        Transport.send(message);
        System.out.println("-------send ok----------------");
    }
    catch(Exception e)
    {
        e.printStackTrace();
        throw new Exception("邮件发送失败..");
    }

    return SUCCESS;
}

是我的本机地址错误吗?
com.sun.mail.smtp.SMTPSendFailedException: 550 admin@zhaohaitao.com esmtp authen
tication failed and this mail server requires smtp authentication.

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答

为你推荐

换一换