当使用java开发的时候,我们经常使用JavaMail API 来连接邮件服务器发送邮件。但是这种方式过于粗笨(主要由邮件的灵活性造成的),所以当你需要多次使用这种方式发送邮件的时候,最好写一个wrapper.根据使用的方式不同,wrapper可以是发送某一特定的邮件,比如说密码提醒,或者作为一种通用的模式,接受主题,接收人,邮件内容作为参数。
rafe@rafe.us someone@example.com someoneelse@example.com rafe@rafe.us This is the subject This is the body of an email message. 可定制的模板
属性文件的一个有用的特性是你可以使用MessageFormat 类用动态传入的值替代属性文件里的被指定参数。比如说,假如你需要在属性文件里指定errors,其中一个errors是file not found, 你可以这样写: file.not.found.error=Error, could not find file {0}.