Class EmailServiceImpl

  • All Implemented Interfaces:
    EmailService

    public class EmailServiceImpl
    extends javax.mail.Authenticator
    implements EmailService
    Provides mail sending services through JavaMail. If a Session instance is provided through JNDI, it will be used. If not, then a session will be created from DSpace configuration data (mail.server etc.)
    Author:
    mwood
    • Constructor Detail

      • EmailServiceImpl

        public EmailServiceImpl()
    • Method Detail

      • setCfg

        @Autowired(required=true)
        public void setCfg​(ConfigurationService cfg)
        Inject/set the ConfigurationService
        Parameters:
        cfg - the configurationService object
      • getSession

        public javax.mail.Session getSession()
        Provide a reference to the JavaMail session.
        Specified by:
        getSession in interface EmailService
        Returns:
        the managed Session, or null if none could be created.
      • init

        @PostConstruct
        public void init()
      • getPasswordAuthentication

        protected javax.mail.PasswordAuthentication getPasswordAuthentication()
        Overrides:
        getPasswordAuthentication in class javax.mail.Authenticator
      • reset

        public void reset()
        Force a new initialization of the session, useful for testing purpose