Skip to content

Instantly share code, notes, and snippets.

@desireesantos
Created August 8, 2013 17:12
Show Gist options
  • Save desireesantos/6186603 to your computer and use it in GitHub Desktop.
Save desireesantos/6186603 to your computer and use it in GitHub Desktop.
HtmlEmail - Criar email com arquivo anexado
package com.trailblazers.freewheelers.model;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;
import static com.trailblazers.freewheelers.model.SetupMail.*;
public class SendFileInMail {
private HtmlEmail email;
public SendFileInMail() {
this(new HtmlEmail());
}
public SendFileInMail(HtmlEmail email) {
this.email = email;
}
public HtmlEmail create() throws EmailException {
email.setHostName(HOSTNAME);
email.setSmtpPort(PORT);
email.setFrom(EMAIL_FROM);
email.setSSLOnConnect(false);
email.setStartTLSEnabled(false);
return email;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment