Package org.apache.commons.mail

Examples of org.apache.commons.mail.DefaultAuthenticator


        if (configuration.isEmailTransportUseSsl()) {
            email.setSslSmtpPort(Integer.toString(configuration.getEmailTransportPort()));
        }

        if(configuration.isEmailTransportUseAuth()) {
            email.setAuthenticator(new DefaultAuthenticator(
                    configuration.getEmailTransportUsername(),
                    configuration.getEmailTransportPassword()
            ));
        }
View Full Code Here


  }

  private void setCommonAttributes(EmailDetailsDto emailDto, MultiPartEmail email) throws EmailException, SwingObjectsException {

    email.setHostName(emailDto.getSmtp());
    email.setAuthenticator(new DefaultAuthenticator(emailDto.getFromEmailID(),emailDto.getFromEmailIDPassword()));
    email.setFrom(emailDto.getFromEmailID(), emailDto.getFromName());
    email.setDebug(true);
    email.getMailSession().getProperties().put("mail.smtp.starttls.enable", "true");
    try {
      if(emailDto.getTo().indexOf(",")!=-1){
View Full Code Here

    email.setHostName(env.get(SERVER));
    email.setSmtpPort(Integer.parseInt(env.get(PORT)));
    boolean tls = env.supports(TLS);
    email.setTLS(tls);
    if (tls) {
      email.setAuthenticator(new DefaultAuthenticator(env.get(USERNAME),
          env.get(PASSWORD)));
    }
    String replyTo = env.get(REPLY_TO);
    if(replyTo != null) {
      email.addReplyTo(replyTo);
View Full Code Here

    public void send(EmailAccount from, Email email) {
        try {
            final HtmlEmail message = new HtmlEmail();
            message.setHostName(smtProperties.getProperty("mail.smtp.host"));
            message.setSmtpPort(Integer.parseInt(smtProperties.getProperty("mail.smtp.port")));
            message.setAuthenticator(new DefaultAuthenticator(
                    from.getEmailAddress(), encrypter.decrypt(from.getPassword())));
            message.setTLS(true);
            message.setFrom(from.getEmailAddress());
            message.setSubject(email.getTitle());
            message.setHtmlMsg(email.getContent());
View Full Code Here

*/
public class EmailConfigTest {
    @Test
    public void testSendEmail() throws EmailException {
         EmailConfig emailConfig = new EmailConfig().
                 setAuthenticator(new DefaultAuthenticator("miguelvega.name@gmail.com", "Mavp8584")).
                 setFrom("miguelvega.name@gmail.com").setHostName("smtp.googlemail.com").setSSL(true).setSmtpPort(465);
        SimpleEmail simpleEmail = emailConfig.newSimpleEmail();

        simpleEmail.setSubject("hello world!");
        simpleEmail.setMsg("This is a simple plain text email");
View Full Code Here

        } else {
            throw new IllegalArgumentException(
                    "Missing settings in System Configuration (see Administration menu) - cannot send mail");
        }
        if (username != null) {
            email.setAuthenticator(new DefaultAuthenticator(username, password));
        }
       
        if(ssl != null) {
            email.setSSL(ssl);
        }
View Full Code Here

  @Override
  public void initialize() {
    m_name = m_manager.getEmailAccount();
    m_password = m_manager.getEmailPassword();
    m_authenticator = new DefaultAuthenticator(m_name, m_password);
  }
View Full Code Here

        if(hasAuth)props.put("mail.transport.connect-timeout", "30" )
        if(port>0)props.put("mail.smtp.port", String.valueOf(port) );
       
       
        Authenticator auth=null;
        if(hasAuth)auth=new DefaultAuthenticator(username,password);
        Session session = Session.getInstance( props, auth);     
       
        Transport transport = session.getTransport("smtp");               
        if(hasAuth)transport.connect( host , username ,password );               
        else transport.connect( );               
View Full Code Here

    email.setHostName(env.get(SERVER));
    email.setSmtpPort(Integer.parseInt(env.get(PORT)));
    boolean tls = env.supports(TLS);
    email.setTLS(tls);
    if (tls) {
      email.setAuthenticator(new DefaultAuthenticator(env.get(USERNAME),
          env.get(PASSWORD)));
    }
    if(env.has(REPLY_TO)) {
      String replyTo = env.get(REPLY_TO);
      email.addReplyTo(replyTo);
View Full Code Here

      email.setHostName(smtpHost);
      email.setSmtpPort(smtpPort);
      email.setCharset("utf-8");

      if (PasswordRecovery.NETWORK_SMTP_AUTHENTICATION.getValueAsBoolean()) {
        email.setAuthenticator(new  DefaultAuthenticator(username_smtp, password_smtp));
      }
      email.setFrom(emailFrom);     
      email.addTo(userEmail);

      email.setSubject(emailSubject);
View Full Code Here

TOP

Related Classes of org.apache.commons.mail.DefaultAuthenticator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.