Package javax.mail

Examples of javax.mail.Transport.connect()


        }

        if (useAuthentication) {
            tr.connect(smtpServer, username, password);
        } else {
            tr.connect();
        }

        tr.sendMessage(message, message.getAllRecipients());

        if (synchronousMode) {
View Full Code Here


  private Transport connectTransport() throws MailException {
    try {
      Transport t = _smtpSession.getTransport("smtp");
      if (isConnect() && !t.isConnected()) {
        t.connect();
      }
      return t;
    } catch (NoSuchProviderException e) {
      throw new RuntimeException("no SMTP provider?", e);
    } catch (MessagingException e) {
View Full Code Here

                    Transport transport = null;
                    try {
                        transport = session.getTransport(outgoingMailServer);
                        try {
                            transport.connect();
                        } catch (MessagingException me) {
                            // Any error on connect should cause the mailet to attempt
                            // to connect to the next SMTP server associated with this
                            // MX record.  Just log the exception.  We'll worry about
                            // failing the message at the end of the loop.
View Full Code Here

        }

        // send the list of emails using a single 'Transport' instance.
        if( EmailConfiguration.MAIL_FORCE_SEND )
        {
            transport.connect();

            for (SimpleEmail personalizedEmail : emails)
            {
                MimeMessage mimeMessage = personalizedEmail.getMimeMessage();
                Transport.send(mimeMessage);
View Full Code Here

    if (ConditionUtils.isEmpty(user)) {
      return null;
    }

    Transport transport = session.getTransport(AbstractMailSender.PROTOCOL);
    transport.connect(smtpServer, port, user, password);
    return transport;
  }

  private static String getContentId(final Attachment a) {
    StringBuilder builder = new StringBuilder();
View Full Code Here

          // If there is someone to send it to, then send it.
          Address[] recipients = email.getAllRecipients();
          if (recipients.length > 0) {
            Transport transport = mailSession.getTransport(recipients[0]);
            try {
              transport.connect();
              transport.sendMessage(email, recipients);
            }
            finally {
              transport.close();
            }
View Full Code Here

    @Override
    public void send(MimeMessage mimeMessage) throws MessagingException {
        Transport transport = getTransport(getSession());
        LOG.debug("Connecting to {}:{}", host, port);
        transport.connect(getHost(), getPort(), getUsername(), getPassword());

        try {
            if (mimeMessage.getSentDate() == null) {
                mimeMessage.setSentDate(new Date());
            }
View Full Code Here

            listener = new SynchronousTransportListener();
            tr.addTransportListener(listener);
        }

        if (useAuthentication) {
            tr.connect(smtpServer, username, password);
        } else {
            tr.connect();
        }

        tr.sendMessage(message, message.getAllRecipients());
View Full Code Here

        }

        if (useAuthentication) {
            tr.connect(smtpServer, username, password);
        } else {
            tr.connect();
        }

        tr.sendMessage(message, message.getAllRecipients());

        if (synchronousMode) {
View Full Code Here

          message.setSubject("XhodonRechner Feedback");
          message.setFrom(addressFrom);
          message.addRecipient(Message.RecipientType.TO, addressTo);
          message.saveChanges();
          Transport transport = session.getTransport("smtp");
          transport.connect(jTextFieldHost.getText(), jTextFieldName.getText(), new String(jTextFieldPassword.getPassword()));
          transport.sendMessage(message, message.getAllRecipients());
          transport.close();
        }
        catch (Exception e1)
        {
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.