exchange邮箱 java_Exchange邮箱发送案例(亲测可用)

1 packagecom.fzw.exchangeClient;2

3 importjava.net.URI;4 importjava.net.URISyntaxException;5 importjava.util.ArrayList;6 importjava.util.Arrays;7 importjava.util.List;8

9 importlombok.extern.slf4j.Slf4j;10 importmicrosoft.exchange.webservices.data.core.ExchangeService;11 importmicrosoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;12 importmicrosoft.exchange.webservices.data.core.exception.service.local.ServiceLocalException;13 importmicrosoft.exchange.webservices.data.core.service.item.EmailMessage;14 importmicrosoft.exchange.webservices.data.credential.ExchangeCredentials;15 importmicrosoft.exchange.webservices.data.credential.WebCredentials;16 importmicrosoft.exchange.webservices.data.property.complex.MessageBody;17

18 @Slf4j19 public classExchangeClient {20

21

22 private finalString hostname;23 private finalExchangeVersion exchangeVersion;24 private finalString domain;25 private finalString username;26 private finalString password;27 private finalString subject;28 private finalString recipientTo;29 private final ListrecipientCc;30 private final ListrecipientBcc;31 private final Listattachments;32 private finalString message;33

34 privateExchangeClient(ExchangeClientBuilder builder) {35 this.hostname =builder.hostname;36 this.exchangeVersion =builder.exchangeVersion;37 this.domain =builder.domain;38 this.username =builder.username;39 this.password =builder.password;40 this.subject =builder.subject;41 this.recipientTo =builder.recipientTo;42 this.recipientCc =builder.recipientCc;43 this.recipientBcc =builder.recipientBcc;44 this.attachments =builder.attachments;45 this.message =builder.message;46 }47

48 public static classExchangeClientBuilder {49

50 privateString hostname;51 privateExchangeVersion exchangeVersion;52 privateString domain;53 privateString username;54 privateString password;55 privateString subject;56 privateString recipientTo;57 private ListrecipientCc;58 private ListrecipientBcc;59 private Listattachments;60 privateString message;61

62 publicExchangeClientBuilder() {63 this.exchangeVersion =ExchangeVersion.Exchange2010_SP1;64 this.hostname = "";65

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值