Package javax.mail

Examples of javax.mail.Transport.sendMessage()


                                convertTo7Bit(message);
                            } catch (IOException e) {
                                log("Error during the conversion to 7 bit.", e);
                            }
                        }
                        transport.sendMessage(message, addr);
                    } finally {
                        if (transport != null) {
                            transport.close();
                            transport = null;
                        }
View Full Code Here


                        //"mail.smtp.dsn.notify" //default to nothing...appended as NOTIFY= after RCPT TO line.
                        //"mail.smtp.localhost" //local server name, InetAddress.getLocalHost().getHostName();

                        Transport transport = session.getTransport(urlname);
                        transport.connect();
                        transport.sendMessage(message, addr);
                        transport.close();
                        log("mail (" + mail.getName() + ") sent successfully to " + outgoingmailserver);
                        return true;
                    } catch (SendFailedException sfe) {
                        throw sfe;
View Full Code Here

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

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

        if (listener != null /*synchronousMode==true*/) {
            listener.attend(); // listener cannot be null here
        }

View Full Code Here

            mimeMessage.saveChanges();
            if (messageId != null) {
              // Preserve explicitly specified message id...
              mimeMessage.setHeader(HEADER_MESSAGE_ID, messageId);
            }
            transport.sendMessage(mimeMessage, mimeMessage.getAllRecipients());
          }
          catch (MessagingException ex) {
            Object original = (originalMessages != null ? originalMessages[i] : mimeMessage);
            failedMessages.put(original, ex);
          }
View Full Code Here

    Transport transport = this.session.getTransport();
    if ( !transport.isConnected() ) {
      transport.connect();
    }

    transport.sendMessage( this.message, this.message.getAllRecipients() );
    transport.close();
  }

  /**
   * @param folder
View Full Code Here

    Transport transport = this.session.getTransport();
    if ( !transport.isConnected() ) {
      transport.connect();
    }

    transport.sendMessage( this.message, this.message.getAllRecipients() );
    transport.close();
  }

  /**
   * @param folder
View Full Code Here

        if (secured) {
            Transport transport = session.getTransport("smtps");
            try {
                transport.connect(smtpUsername, smtpPassword);
                transport.sendMessage(m, m.getAllRecipients());
            } finally {
                transport.close();
            }
        } else {
            Transport.send(m);
View Full Code Here

            + password);
      t.connect(g_smtpHost, username, password);
      if (log4j.isDebugEnabled())
        log4j.debug("send() - transport connected: " + t.isConnected()
            + ", now to try and send....");
      t.sendMessage(g_smtpMsg, g_smtpMsg.getAllRecipients());
      t.close();
    } catch (MessagingException mex) {
      log4j.error("Exception handling in EMail.java: " + mex.toString());
      sb.append("Exception handling in EMail.java\n");
View Full Code Here

                        //"mail.smtp.dsn.notify" //default to nothing...appended as NOTIFY= after RCPT TO line.
                        //"mail.smtp.localhost" //local server name, InetAddress.getLocalHost().getHostName();

                        Transport transport = session.getTransport(urlname);
                        transport.connect();
                        transport.sendMessage(message, addr);
                        transport.close();
                        log("mail (" + mail.getName() + ") sent successfully to " + outgoingmailserver);
                        return;
                    } catch (MessagingException me) {
      log("Exception caught in RemoteDelivery.deliver() : " + me);
View Full Code Here

            if (auth) {
                transport.connect(config.get("user"), config.get("password"));
            } else {
                transport.connect();
            }
            transport.sendMessage(msg, new InternetAddress[]{new InternetAddress(address)});
        } catch (Exception e) {
            log.warn("Failed to send email", e);
            throw new EmailException(e);
        }
    }
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.