import java.io.File;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.mail.MailException;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import com.opensymphony.xwork2.TextProvider;
import com.yinhoo.elink.domain.Branch;
import com.yinhoo.elink.domain.Message;
import com.yinhoo.elink.helper.Constants;
import com.yinhoo.elink.helper.form.EmailTemplate;
import com.yinhoo.elink.helper.form.SignupForm;
import com.yinhoo.framework.spring.PropertiesManager;
public void sentGeneralReportToEmails(String toEmailAddress, String htmlPath, Message message, TextProvider provider) throws Exception{
EmailTemplate verifyReplyAddressEmail = this.emailTemplateCenter.getSendReportTemplate(message, provider);
MimeMessage mimeMessage = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage,true,Constants.UTF_8);
helper.setTo(toEmailAddress.split(Constants.DELIMITER));
helper.setSubject(verifyReplyAddressEmail.getSubject());
helper.setText(verifyReplyAddressEmail.getTextContent());
helper.addAttachment(new File(htmlPath).getName(), new File(htmlPath));
this.mailSender.send(mimeMessage);
}