com.gisgraphy.service

## Class MailEngine

- java.lang.Object
- - com.gisgraphy.service.MailEngine

-     public class MailEngine
      extends Object

  Class for sending e-mail messages based on Velocity templates or with attachments.
  Author:
    Matt Raible

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MailEngine()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `send(org.springframework.mail.SimpleMailMessage msg)` Send a simple message with pre-populated values.
    `void` | `sendMessage(org.springframework.mail.SimpleMailMessage msg, String templateName, Map model)` Send a simple message based on a Velocity template.
    `void` | `sendMessage(String[] recipients, String sender, org.springframework.core.io.ClassPathResource resource, String bodyText, String subject, String attachmentName)` Convenience method for sending messages with attachments.
    `void` | `setMailSender(org.springframework.mail.MailSender mailSender)`
    `void` | `setVelocityEngine(org.apache.velocity.app.VelocityEngine velocityEngine)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MailEngine

          public MailEngine()

  - ### Method Detail

    - #### setMailSender

          public void setMailSender(org.springframework.mail.MailSender mailSender)

    - #### setVelocityEngine

          public void setVelocityEngine(org.apache.velocity.app.VelocityEngine velocityEngine)

    - #### sendMessage

          public void sendMessage(org.springframework.mail.SimpleMailMessage msg,
                         String templateName,
                         Map model)

      Send a simple message based on a Velocity template.
      Parameters:
        `msg` - the message to populate
        `templateName` - the Velocity template to use (relative to classpath)
        `model` - a map containing key/value pairs

    - #### send

          public void send(org.springframework.mail.SimpleMailMessage msg)

      Send a simple message with pre-populated values.
      Parameters:
        `msg` - the message to send

    - #### sendMessage

          public void sendMessage(String[] recipients,
                         String sender,
                         org.springframework.core.io.ClassPathResource resource,
                         String bodyText,
                         String subject,
                         String attachmentName)
                           throws javax.mail.MessagingException

      Convenience method for sending messages with attachments.
      Parameters:
        `recipients` - array of e-mail addresses
        `sender` - e-mail address of sender
        `resource` - attachment from classpath
        `bodyText` - text in e-mail
        `subject` - subject of e-mail
        `attachmentName` - name for attachment
      Throws:
        `javax.mail.MessagingException` - thrown when can't communicate with SMTP server

Copyright © 2015. All rights reserved.