SHARE
TWEET

Untitled

a guest Dec 31st, 2018 164 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Create the attachment
  2.           EmailAttachment attachment = new EmailAttachment();
  3.           attachment.setPath(".\Test-Report.html");
  4.           attachment.setDisposition(EmailAttachment.ATTACHMENT);
  5.           attachment.setDescription("ePQS AT Report");
  6.           attachment.setName("ePQS AT Report");
  7.  
  8.           // Create the email message
  9.           MultiPartEmail email = new MultiPartEmail();
  10.           email.setHostName("smtp.gmail.com");
  11.           email.setAuthenticator(new DefaultAuthenticator("peterapiit@gmail.com", "giqqpudmcjjmpbcc"));
  12.           email.addTo("peterapiit@gmail.com", "Nicholas Wong");
  13.           email.setFrom("peterapiit@gmail.com", "Nicholas Wong");
  14.           email.setSubject("Test Email");
  15.           email.setMsg("Here is the picture you wanted");
  16.           email.setStartTLSEnabled(true);
  17.           email.setDebug(true);
  18.           email.setSmtpPort(587);
  19.  
  20.           // add the attachment
  21.           email.attach(attachment);
  22.  
  23.           // send the email
  24.           email.send();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top