当前位置: 首页>>代码示例>>Java>>正文


Java Email.addBcc方法代码示例

本文整理汇总了Java中org.apache.commons.mail.Email.addBcc方法的典型用法代码示例。如果您正苦于以下问题:Java Email.addBcc方法的具体用法?Java Email.addBcc怎么用?Java Email.addBcc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.mail.Email的用法示例。


在下文中一共展示了Email.addBcc方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addBcc

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
protected void addBcc(Email email, String bcc) {
    String[] bccs = splitAndTrim(bcc);
    if (bccs != null) {
        for (String b : bccs) {
            try {
                email.addBcc(b);
            } catch (EmailException e) {
                throw new FlowableException("Could not add " + b + " as bcc recipient", e);
            }
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:13,代码来源:MailActivityBehavior.java

示例2: addBcc

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
protected void addBcc(Email email, String bcc) {
    String[] bccs = splitAndTrim(bcc);
    if (bccs != null) {
        for (String b : bccs) {
            try {
                email.addBcc(b);
            } catch (EmailException e) {
                throw new ActivitiException("Could not add " + b + " as bcc recipient", e);
            }
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:13,代码来源:MailActivityBehavior.java

示例3: initializeEmail

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
private void initializeEmail(final Email email) throws EmailException {
	email.setSocketConnectionTimeout(configuration.getInt("email.connection.timeout", Defaults.SOCKET_CONNECTION_TIMEOUT));
	email.setSocketTimeout(configuration.getInt("email.socket.timeout", Defaults.SOCKET_TIMEOUT));
	email.setStartTLSEnabled(configuration.getBoolean("email.starttls.enabled", Defaults.STARTTLS_ENABLED));
	email.setStartTLSRequired(configuration.getBoolean("email.starttls.required", Defaults.STARTTLS_REQUIRED));
	email.setSSLCheckServerIdentity(configuration.getBoolean("email.ssl.identity", Defaults.SSL_IDENTITY));
	email.setSSLOnConnect(configuration.getBoolean("email.ssl.connect", Defaults.SSL_CONNECT));
	email.setSmtpPort(configuration.getInt("email.port", Defaults.PORT));
	email.setSslSmtpPort(Integer.toString(configuration.getInt("email.ssl.port", Defaults.SSL_PORT)));

	email.setHostName(configuration.getString(CFG_KEY_EMAIL_HOST));

	// Authentication
	if (!configuration.getString(CFG_KEY_EMAIL_USERNAME, true).isEmpty() && !configuration.getString(CFG_KEY_EMAIL_PASSWORD, true).isEmpty()) {
		email.setAuthenticator(new DefaultAuthenticator(configuration.getString(CFG_KEY_EMAIL_USERNAME), configuration.getString(CFG_KEY_EMAIL_PASSWORD)));
	}

	// Sender
	if (configuration.getString(CFG_KEY_EMAIL_FROM_NAME, true).isEmpty()) {
		email.setFrom(configuration.getString(CFG_KEY_EMAIL_FROM_ADDRESS));
	}
	else {
		email.setFrom(configuration.getString(CFG_KEY_EMAIL_FROM_ADDRESS), configuration.getString(CFG_KEY_EMAIL_FROM_NAME));
	}

	// Recipients
	if (!configuration.getString(CFG_KEY_EMAIL_TO_ADDRESSES, true).isEmpty()) {
		email.addTo(configuration.getString(CFG_KEY_EMAIL_TO_ADDRESSES).split(EMAIL_ADDRESSES_SPLIT_REGEX));
	}
	if (!configuration.getString(CFG_KEY_EMAIL_CC_ADDRESSES, true).isEmpty()) {
		email.addCc(configuration.getString(CFG_KEY_EMAIL_CC_ADDRESSES).split(EMAIL_ADDRESSES_SPLIT_REGEX));
	}
	if (!configuration.getString(CFG_KEY_EMAIL_BCC_ADDRESSES, true).isEmpty()) {
		email.addBcc(configuration.getString(CFG_KEY_EMAIL_BCC_ADDRESSES).split(EMAIL_ADDRESSES_SPLIT_REGEX));
	}
}
 
开发者ID:Albertus82,项目名称:RouterLogger,代码行数:37,代码来源:EmailSender.java

示例4: addBcc

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
protected void addBcc(Email email, String bcc) {
  String[] bccs = splitAndTrim(bcc);
  if (bccs != null) {
    for (String b : bccs) {
      try {
        email.addBcc(b);
      } catch (EmailException e) {
        throw new ActivitiException("Could not add " + b + " as bcc recipient", e);
      }
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:13,代码来源:MailActivityBehavior.java

示例5: sendSimpleEmail

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
private void sendSimpleEmail() throws MangooMailerException {
    Config config = Application.getInstance(Config.class);
    try {
        Email email = new SimpleEmail();
        email.setCharset(Default.ENCODING.toString());
        email.setHostName(config.getSmtpHost());
        email.setSmtpPort(config.getSmtpPort());
        email.setAuthenticator(getDefaultAuthenticator());
        email.setSSLOnConnect(config.isSmtpSSL());
        email.setFrom(this.from);
        email.setSubject(this.subject);
        email.setMsg(render());
        
        for (String recipient : this.recipients) {
            email.addTo(recipient);
        }
        
        for (String cc : this.ccRecipients) {
            email.addCc(cc);
        }
        
        for (String bcc : this.bccRecipients) {
            email.addBcc(bcc);
        }
        
        email.send();
    } catch (EmailException | MangooTemplateEngineException e) {
        throw new MangooMailerException(e);
    }        
}
 
开发者ID:svenkubiak,项目名称:mangooio,代码行数:31,代码来源:Mail.java

示例6: addBcc

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
protected void addBcc(Email email, String bcc) {
  String[] bccs = splitAndTrim(bcc);
  if (bccs != null) {
    for (String b : bccs) {
      try {
        email.addBcc(b);
      } catch (EmailException e) {
        throw LOG.addBccException(b, e);
      }
    }
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:13,代码来源:MailActivityBehavior.java

示例7: sendsimpleEmail2

import org.apache.commons.mail.Email; //导入方法依赖的package包/类
public void sendsimpleEmail2(Email email, String userName, String password,
		String subject, String simpleEmailBody, String from, String to,
		String cc, String bcc) throws EmailException {

	// 创建SimpleEmail对象

	// 显示调试信息用于IED中输出
	email.setDebug(true);

	// 设置发送电子邮件的邮件服务器
	email.setHostName("smtp.gmail.com");

	// 邮件服务器是否使用ssl加密方式gmail就是,163就不是)
	email.setSSL(Boolean.TRUE);

	// 设置smtp端口号(需要查看邮件服务器的说明ssl加密之后端口号是不一样的)
	email.setSmtpPort(465);

	// 设置发送人的账号/密码
	email.setAuthentication(userName, password);

	// 显示的发信人地址,实际地址为gmail的地址
	email.setFrom(from);
	// 设置发件人的地址/称呼
	// email.setFrom("[email protected]", "发送人");

	// 收信人地址
	email.addTo(to);
	// 设置收件人的账号/称呼)
	// email.addTo("[email protected]", "收件人");

	// 多个抄送地址
	StrTokenizer stokenCC = new StrTokenizer(cc.trim(), ";");
	// 开始逐个抄送地址
	for (int i = 0; i < stokenCC.getTokenArray().length; i++) {
		email.addCc((String) stokenCC.getTokenArray()[i]);
	}

	// 多个密送送地址
	StrTokenizer stokenBCC = new StrTokenizer(bcc.trim(), ";");
	// 开始逐个抄送地址
	for (int i = 0; i < stokenBCC.getTokenArray().length; i++) {
		email.addBcc((String) stokenBCC.getTokenArray()[i]);
	}

	// Set the charset of the message.
	email.setCharset("UTF-8");

	email.setSentDate(new Date());

	// 设置标题,但是不能设置编码,commons 邮件的缺陷
	email.setSubject(subject);

	// 设置邮件正文
	email.setMsg(simpleEmailBody);

	// 就是send发送
	email.send();

	// 这个是我自己写的。
	System.out.println("The SimpleEmail send sucessful!");

}
 
开发者ID:h819,项目名称:spring-boot,代码行数:64,代码来源:SendEmaiWithGmail.java


注:本文中的org.apache.commons.mail.Email.addBcc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。