Package javax.mail

Examples of javax.mail.Transport.sendMessage()


            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


        Message message = prepareMessage(email);
        message.saveChanges();

        Transport t = session.getTransport(transport.getProtocol());
        t.connect();
        t.sendMessage(message, message.getAllRecipients());
        t.close();
      } catch (UnsupportedEncodingException e) {
        log.log(Level.SEVERE, e.getMessage(), e);
        throw new MailException(String.format(
            MailException.INVALID_ENCODING, e.getMessage()));
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(!transport.isConnected())
          transport.connect(host,port,user,pass);

         
      mmas.message.saveChanges()
      transport.sendMessage(mmas.message, mmas.message.getAllRecipients());
      hasSended=true;
    }
    catch (Throwable t) {
      this.throwable=t;
    }
View Full Code Here

        msg.setRecipients(RecipientType.TO, toAddress);
        msg.setSubject(subject);
        msg.setContent(text, mimeType);
       
        t.connect(host, username, password);
        t.sendMessage(msg, msg.getAllRecipients());
       
      }
      catch (MessagingException e)
      {
        sendMail = false;
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

         */
        // put everything together
        message.setContent(multipart);

        transport.connect();
        transport.sendMessage(message, message.getRecipients(Message.RecipientType.TO));
        transport.close();
    }

    public String getHost() {
        return host;
View Full Code Here

                p.get(Constants.MAIL_HOST),
                p.get(Constants.MAIL_USER),
                p.get(Constants.MAIL_PASS)
            );

            t.sendMessage(
                msg,
                msg.getAllRecipients()
            );

        }
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

                                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

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.