Package javax.mail

Examples of javax.mail.Transport.sendMessage()


            requestMessage.setDataHandler(
                    new DataHandler(new ByteArrayDataSource(requestContentType, requestBuffer.toByteArray())));
            transport = session.getTransport(transportUri);
            transport.connect();
            requestMessage.saveChanges();
            transport.sendMessage(requestMessage, requestMessage.getAllRecipients());
        }
        catch (MessagingException ex) {
            throw new MailTransportException(ex);
        }
        finally {
View Full Code Here


           
            // send the thing off
          Transport t = (Transport)session.getTransport("smtp");
          try {
            t.connect(mailhost, username, password);
          t.sendMessage(msg, msg.getAllRecipients());
          } catch (Exception e) {
            throw new RuntimeException( "Connection failure", e );
           } finally {
            t.close();
          }
View Full Code Here

            msg.setContent(attachments);
            try {
                // Send the message using SMTP, or SMTPS if the host uses SSL
                Transport transport = sesh.getTransport(SSL ? "smtps" : "smtp");
                transport.connect(host, user, password);
                transport.sendMessage(msg, msg.getAllRecipients());
            } catch (SendFailedException sfe) {
                if (!shouldIgnoreInvalidRecipients()) {
                    throw new BuildException(GENERIC_ERROR, sfe);
                } else if (sfe.getValidSentAddresses() == null
                           || sfe.getValidSentAddresses().length == 0) {
View Full Code Here

            if (!useSmtpAuth) {
                trans.connect();
            } else {
                trans.connect(sendVia, authUser, authPass);
            }
            trans.sendMessage(mail, mail.getAllRecipients());
            results.put("messageId", mail.getMessageID());
            trans.close();
        } catch (SendFailedException e) {
            // message code prefix may be used by calling services to determine the cause of the failure
            String errMsg = "[ADDRERR] Address error when sending message to [" + sendTo + "] from [" + sendFrom + "] cc [" + sendCc + "] bcc [" + sendBcc + "] subject [" + subject + "]";
View Full Code Here

                        transport.connect();
                     }
                     message.saveChanges();

                     if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Sending message");
                     transport.sendMessage(message, message.getAllRecipients());
                     transport.close();
                     if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Message sent");
                  }
                  catch (Exception e)
                  {
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

        }
        message.setSubject("SGI Evaluation");
        message.setText(text);
        Transport transport = session.getTransport("smtp");
        transport.connect(host, from, pass);
        transport.sendMessage(message, message.getAllRecipients());
        transport.close();
    }
}
View Full Code Here

            msg.setContent(attachments);
            try {
                // Send the message using SMTP, or SMTPS if the host uses SSL
                Transport transport = sesh.getTransport(SSL ? "smtps" : "smtp");
                transport.connect(host, user, password);
                transport.sendMessage(msg, msg.getAllRecipients());
            } catch (SendFailedException sfe) {
                if (!shouldIgnoreInvalidRecipients()) {
                    throw new BuildException(GENERIC_ERROR, sfe);
                } else if (sfe.getValidSentAddresses() == null
                           || sfe.getValidSentAddresses().length == 0) {
View Full Code Here

            Transport transport = null;
           
            try {
                final JavaMailGmailMessage msg = (JavaMailGmailMessage) message;
                transport = getGmailTransport();
                transport.sendMessage(
                        msg.getMessage(),
                        msg.getMessage().getAllRecipients());
            } catch (final Exception e) {
                throw new GmailException("Failed sending message: " + message, e);
            }
View Full Code Here

                    // Create the JavaMail message
                    final Message msg = createMessage(request.getEntity(),
                            session);

                    // Send the message
                    tr.sendMessage(msg, msg.getAllRecipients());
                    tr.close();

                    getLogger().info(
                            "JavaMail client successfully sent the message.");
                }
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.