我写了一个发送邮件的小程序,在测试时,发信人和收信人都是用的我自己的邮箱。结果没有收到正确的信息,而是一封如下所示的信:
发信人:postmaster@xuyan
收信人:[email protected]
主题:Delivery Status Notification (Failure)
内容:
This is an automatically generated Delivery Status Notification.Delivery to the following recipients failed. [email protected]
发信人:postmaster@xuyan
收信人:[email protected]
主题:Delivery Status Notification (Failure)
内容:
This is an automatically generated Delivery Status Notification.Delivery to the following recipients failed. [email protected]
Properties props = new Properties(); props.put("mail.smtp.host", MailSettings.smtpHost);
props.put("mail.debug", "true");
props.put("mail.smtp.auth", "true"); //这样才能通过验证
System.Net.Mail.MailPriority.High;