Examples of MailException


Examples of com.alibaba.citrus.service.mail.MailException

                }

                message.setFlag(Flags.Flag.DELETED, deleteMessage);
            }
        } catch (MessagingException me) {
            throw new MailException("Could not receive messages", me);
        } finally {
            try {
                if (inbox != null && inbox.isOpen()) {
                    inbox.close(true);
                }
View Full Code Here

Examples of com.alibaba.citrus.service.mail.MailException

                if (getHandler() != null) {
                    getHandler().prepareConnection(transport);
                }
            } catch (NoSuchProviderException e) {
                transport = null;
                throw new MailException("Could not find a provider of " + getProtocol() + " protocol", e);
            } catch (MessagingException me) {
                transport = null;
                throw new MailException("Could not connect to the transport", me);
            }
        }
    }
View Full Code Here

Examples of com.alibaba.citrus.service.mail.MailException

            message.saveChanges();

            Address[] recipients = message.getAllRecipients();

            if (isEmptyArray(recipients)) {
                throw new MailException("No recipient was specified in mail");
            }

            transport.sendMessage(message, recipients);
        } catch (MessagingException me) {
            throw new MailException("Could not send message", me);
        } finally {
            if (autoClose) {
                close();
            }
        }
View Full Code Here

Examples of com.blazebit.mail.MailException

  public SimpleMailSender(String host, Integer port, String username,
      String password, MailTransport transport) {

    if (host == null || host.trim().equals("")) {
      throw new MailException(MailException.MISSING_HOST);
    } else if ((password != null && !password.trim().equals(""))
        && (username == null || username.trim().equals(""))) {
      throw new MailException(MailException.MISSING_USERNAME);
    }

    this.transport = transport;
    this.session = createMailSession(host, port, username, password);
  }
View Full Code Here

Examples of com.blazebit.mail.MailException

        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()));
      } catch (MessagingException e) {
        log.log(Level.SEVERE, e.getMessage(), e);
        throw new MailException(String.format(
            MailException.GENERIC_ERROR, e.getMessage()), e);
      } finally {
        transport.clearTemporaryTrustedHosts();
      }
    }
View Full Code Here

Examples of com.google.code.lightssh.common.mail.MailException

   */
  protected void fillConfig( Email email,ConnectionConfig conf,
      MailAddress mailAddress,MailContent content){
     
      if( conf == null )
        throw new MailException("邮件服务器连接参数为空!");
     
      email.setHostName( conf.getHost() );
      email.setAuthentication( conf.getUsername(), conf.getPassword() );
      int port = 25;
      try{
        port = Integer.valueOf( conf.getPort()).intValue();
      }catch( NumberFormatException e ){
        log.warn("邮箱端口设置出错,使用默认值[25]。");
      }
     
      if( conf.isSsl() ){
        email.setSslSmtpPort(String.valueOf(port));
        email.setTLS(true);
      }else
        email.setSmtpPort( port );
     
      email.setSSL(conf.isSsl());
     
      //邮件地址
      if( mailAddress == null || mailAddress.getFrom()==null
          || mailAddress.getTo() == null ){
        throw new MailException("邮件发送人地址、邮件接收人地址为空!");
      }
     
      try{
        //mail from address
        Address from = mailAddress.getFrom();
        email.setFrom( from.getEmail(), from.getName() );
       
        //添加收件人
        if( mailAddress.getTo() == null || mailAddress.getTo().isEmpty() )
          throw new MailException("未设定邮件接收者!");
       
        for( Address to:mailAddress.getTo() ){
          email.addTo( to.getEmail(), to.getName() );
        }
       
        //添加抄送人
        if( mailAddress.getCc() != null ){
          for( Address cc:mailAddress.getCc() ){
            email.addCc( cc.getEmail(), cc.getName() );
          }
        }
       
        email.setSubject( content.getSubject() );
        email.setCharset( charset ); //("UTF-8")避免中文内容出现乱码
        if( email instanceof HtmlEmail)
          ((HtmlEmail) email).setHtmlMsg(content.getText());
        else
          email.setMsg( content.getText() );   
       
        email.setDebug( debug );
      }catch( org.apache.commons.mail.EmailException ee){
        throw new MailException( ee );
      }   
     
  }
View Full Code Here

Examples of com.google.code.lightssh.common.mail.MailException

      fillConfig( email,conf,mailAddress,mail );
     
      try{
        email.send();
      }catch( org.apache.commons.mail.EmailException ee){
        throw new MailException( ee );
      }   
  }
View Full Code Here

Examples of com.google.code.lightssh.common.mail.MailException

    fillConfig( email,conf,mailAddress,mail );
   
    try{
      email.send();
    }catch( org.apache.commons.mail.EmailException ee){
      throw new MailException( ee );
    }   
  }
View Full Code Here

Examples of com.google.code.lightssh.common.mail.MailException

      for( Attachment att: attachments ){     
        email.attach( att.getSource(), att.getName(), att.getDescription() );
      }
      email.send();
    }catch( org.apache.commons.mail.EmailException ee){
      throw new MailException( ee );
    }  
   
  }
View Full Code Here

Examples of jodd.mail.MailException

  @Override
  public DataSource getDataSource() {
    try {
      return new ByteArrayDataSource(inputStream, contentType);
    } catch (IOException ioex) {
      throw new MailException(ioex);
    }
  }
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.