Skip to content

Instantly share code, notes, and snippets.

@vijaykiran
Created August 5, 2011 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vijaykiran/1127205 to your computer and use it in GitHub Desktop.
Save vijaykiran/1127205 to your computer and use it in GitHub Desktop.
public static void sendMail() throws Exception{
EmailAttachment attachment = new EmailAttachment();
attachment.setPath("/Users/vijay/Desktop/test.scala");
attachment.setDisposition(EmailAttachment.ATTACHMENT);
attachment.setDescription("Scala File");
attachment.setName("test.scala");
// Create the email message
MultiPartEmail email = new MultiPartEmail();
email.addTo("blah@example.com", "Vijay Kiran");
email.setFrom("me@apache.org", "Me");
email.setSubject("The picture");
email.setMsg("Here is the picture you wanted");
// add the attachment
email.attach(attachment);
Mail.send(email);
render();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment