Unable to send emails with attachment using Groovy -


i not know why unable import class multipartemail. seems code not work unless multipartemail class imported.

  // importing groovy classes   import org.apache.commons.mail.*;       // create attachment   emailattachment attachment = new emailattachment();   attachment.setpath("libraries/pictures");   attachment.setdisposition(emailattachment.attachment);   attachment.setdescription("company logo.jpg");   attachment.setname("mycompany");    // create email message   multipartemail email = new multipartemail();   email.sethostname("255.255.255.0");   email.setport("25")   email.addto("addemailhere", "name");   email.setfrom("from@anywhere.net", "sam");   email.setsubject("email groovy");   email.setmsg("test email");    // add attachment   email.attach("company logo.jpg");    // send email   email.send(); 


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -