Package com.sun.mail.smtp

Examples of com.sun.mail.smtp.SMTPTransport.connect()


    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);
View Full Code Here


   * @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

    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.
View Full Code Here

                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

                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

                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

                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

        InternetAddress addressTo = new InternetAddress(recipient);
        msg.setRecipient(Message.RecipientType.TO, addressTo);
        msg.setSubject(subject);
        msg.setContent(message, "text/plain");
        SMTPTransport t = (SMTPTransport) session.getTransport("smtps");
        t.connect(mailhost, authUsername, authPassword);
        logger.debug("smtps: connected to " + mailhost);
        t.sendMessage(msg, msg.getAllRecipients());
        t.close();
        logger.info("mail send to " + recipient);
      }
View Full Code Here

                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.setSentDate(new Date());

   
      SMTPTransport t = (SMTPTransport) session.getTransport(prot);
      try {
      t.connect(mailhost, user, password);
      t.sendMessage(msg, msg.getAllRecipients());
    }
    finally {
      System.out.println("Response: " + t.getLastServerResponse());
      t.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.