class OrderMailer extends BaseMailer {

	public AsyncToken sendConfirmOrder(final String username) {
		final SimpleMailMessage msg = createConfirmOrder(username);
		
		//转换为html邮件并发送,另有一个参数可以指定发件人名称
		AsyncToken token = getAsyncJavaMailSender().send(SimpleMailMessageUtils.toHtmlMsg(msg,"rapid小明")); 
		
		//处理邮件发送结果
		token.addResponder(new IResponder() {
			public void onFault(Exception fault) {
				System.out.println("[ERROR] confirmOrder mail send fail,cause:"+fault);
			}
			public void onResult(Object result) {
				System.out.println("[INFO] confirmOrder mail send success");
			}
		});
		
		//返回token可以用于外部继续监听
		return token;
	}

}