为什么我们需要添加像为什么JavaMail使用System.getProperties()?
Properties props = System.getProperties();
props.put("mail.smtp.starttls.enable", "true"); // added this line
props.put("mail.smtp.host", host);
props.put("mail.smtp.user", from);
props.put("mail.smtp.password", pass);
props.put("mail.smtp.port", "587");
Session session = Session.getDefaultInstance(props, null);
到系统属性的属性来发送邮件。为什么它应该是特定的系统属性?
如何能像你的用户名,密码默认? – adarshr 2012-02-27 15:27:42
@adarshr:那不是我的意思。我只是想知道为什么它被添加到系统属性中。 – Ashwin 2012-02-27 15:30:54
这只是一种向方法发送大量参数的方法。 – adarshr 2012-02-27 15:31:34