Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JavaMailerService javamailerservice
- def x = {javamailerservice.serviceMethod()} }
- boolean transactional = false
- def serviceMethod() { String d_email = "[email protected]",
- d_password = "thispassword",
- d_host = "smtp.gmail.com",
- d_port = "587",
- m_to = "[email protected]",
- m_subject = "Testing",
- m_text = "Hey, this is the testing email.";
- Properties props = new Properties();
- props.put("mail.smtp.user", d_email);
- props.put("mail.smtp.host", d_host);
- props.put("mail.smtp.port", d_port);
- props.put("mail.smtp.starttls.enable","true");
- SecurityManager security = System.getSecurityManager();
- try
- {
- Authenticator auth = new SMTPAuthenticator();
- Session session = Session.getInstance(props, auth);
- //session.setDebug(true);
- MimeMessage msg = new MimeMessage(session);
- msg.setText(m_text);
- msg.setSubject(m_subject);
- msg.setFrom(new InternetAddress(d_email));
- msg.addRecipient(Message.RecipientType.TO,
- class JavaMailerController {
- JavaMailerService javaMailerService
- def x = {
- javaMailerService.serviceMethod()
- }
- }
Add Comment
Please, Sign In to add comment