Package com.sun.mail.smtp

Examples of com.sun.mail.smtp.SMTPTransport$DigestMD5Authenticator


      assert port == DEFAULT_PORT;

      assert "smtp".equals(session.getProperty("mail.transport.protocol"));
     
      SMTPTransport transport = null;

      try
      {
         assert session.getTransport() instanceof SMTPTransport;
         transport = (SMTPTransport) session.getTransport();
      }
      catch (NoSuchProviderException e)
      {
         assert false;
      }

      assert !session.getDebug();

      assert transport.getStartTLS();

   }
View Full Code Here


    baseMsg.setSubject("Test Big attached file message");
    baseMsg.setContent(multipart);
    baseMsg.saveChanges();

    log.debug("Send started");
    Transport t = new SMTPTransport(session, new URLName("smtp://localhost:"+SMTP_PORT));
    long started = System.currentTimeMillis();
    t.connect();
    t.sendMessage(baseMsg, new Address[] {new InternetAddress(
        "success@subethamail.org")});
    t.close();
    started = System.currentTimeMillis() - started;
    log.info("Elapsed ms = "+started);

    WiserMessage msg = this.server.getMessages().get(0);
View Full Code Here

   *
   * @param msg Email Message
   * @throws MessagingException
   */
  protected void send(Message msg) throws MessagingException {
    SMTPTransport t = (SMTPTransport)session.getTransport("smtps");
    try {
      t.connect(getSMTPHost(), getSMTPUsername(), getSMTPPassword());
      t.sendMessage(msg, msg.getAllRecipients());
    } finally {
      t.close();
    }
  }
View Full Code Here

    props.put("mail.smtp.sasl.enable", "false");
    Session session = Session.getInstance(props);
    session.setDebug(debug);

    final URLName unusedUrlName = null;
    SMTPTransport transport = new SMTPTransport(session, unusedUrlName);
    // If the password is non-null, SMTP tries to do AUTH LOGIN.
    final String emptyPassword = null;
    transport.connect(host, port, userEmail, emptyPassword);

    /*
     * I couldn't get the SASL infrastructure to work with JavaMail 1.4.3;
     * I don't think it was ready yet in that release. So we'll construct the
     * AUTH command manually.
     */
    XoauthSaslResponseBuilder builder = new XoauthSaslResponseBuilder();
    byte[] saslResponse = builder.buildResponse(userEmail,
                                                XoauthProtocol.SMTP,
                                                oauthToken,
                                                oauthTokenSecret,
                                                consumer);
    saslResponse = BASE64EncoderStream.encode(saslResponse);
    transport.issueCommand("AUTH XOAUTH " + new String(saslResponse),
                           235);
    return transport;
  }
View Full Code Here

                                              oauthToken,
                                              oauthTokenSecret,
                                              getAnonymousConsumer(),
                                              true);
    System.out.println("Successfully authenticated to IMAP.\n");
    SMTPTransport smtpTransport = connectToSmtp("smtp.googlemail.com",
                                                587,
                                                email,
                                                oauthToken,
                                                oauthTokenSecret,
                                                getAnonymousConsumer(),
View Full Code Here

                msg.setSubject("You are invited to join the cloud stack project id=" + projectId);
                msg.setSentDate(new Date(DateUtil.currentGMTTime().getTime() >> 10));
                msg.setContent(content, "text/plain");
                msg.saveChanges();

                SMTPTransport smtpTrans = null;
                if (_smtpUseAuth) {
                    smtpTrans = new SMTPSSLTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                } else {
                    smtpTrans = new SMTPTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                }
                smtpTrans.connect();
                smtpTrans.sendMessage(msg, msg.getAllRecipients());
                smtpTrans.close();
            } else {
                throw new CloudRuntimeException("Unable to send email invitation; smtp ses");
            }
        }
View Full Code Here

                msg.setSubject(subject);
                msg.setSentDate(new Date());
                msg.setContent(content, "text/plain");
                msg.saveChanges();

                SMTPTransport smtpTrans = null;
                if (_smtpUseAuth) {
                    smtpTrans = new SMTPSSLTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                } else {
                    smtpTrans = new SMTPTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                }
                smtpTrans.connect();
                smtpTrans.sendMessage(msg, msg.getAllRecipients());
                smtpTrans.close();
            }
        }
View Full Code Here

                msg.setSubject(subject);
                msg.setSentDate(new Date());
                msg.setContent(content, "text/plain");
                msg.saveChanges();

                SMTPTransport smtpTrans = null;
                if (_smtpUseAuth) {
                    smtpTrans = new SMTPSSLTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                } else {
                    smtpTrans = new SMTPTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                }
                sendMessage(smtpTrans, msg);
            }
        }
View Full Code Here

                msg.setSubject("You are invited to join the cloud stack project id=" + projectId);
                msg.setSentDate(new Date(DateUtil.currentGMTTime().getTime() >> 10));
                msg.setContent(content, "text/plain");
                msg.saveChanges();

                SMTPTransport smtpTrans = null;
                if (_smtpUseAuth) {
                    smtpTrans = new SMTPSSLTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                } else {
                    smtpTrans = new SMTPTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                }
                smtpTrans.connect();
                smtpTrans.sendMessage(msg, msg.getAllRecipients());
                smtpTrans.close();
            } else {
                throw new CloudRuntimeException("Unable to send email invitation; smtp ses");
            }
        }
View Full Code Here

                msg.setSubject(subject);
                msg.setSentDate(new Date());
                msg.setContent(content, "text/plain");
                msg.saveChanges();

                SMTPTransport smtpTrans = null;
                if (_smtpUseAuth) {
                    smtpTrans = new SMTPSSLTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                } else {
                    smtpTrans = new SMTPTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                }
                smtpTrans.connect();
                smtpTrans.sendMessage(msg, msg.getAllRecipients());
                smtpTrans.close();
            }
        }
View Full Code Here

TOP

Related Classes of com.sun.mail.smtp.SMTPTransport$DigestMD5Authenticator

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.