当前位置: 首页 > news >正文

网站建设的发展历史与新方向/seo运营

网站建设的发展历史与新方向,seo运营,ipad 设计网站,网站建设pdf 下载使用java发送exchange类型的邮件&#xff0c;foxmail中配置如下图&#xff1a; 需要的maven依赖如下&#xff1a; <dependency><groupId>com.microsoft.ews-java-api</groupId><artifactId>ews-java-api</artifactId><version>2.0</ve…

使用java发送exchange类型的邮件,foxmail中配置如下图:

需要的maven依赖如下:

<dependency><groupId>com.microsoft.ews-java-api</groupId><artifactId>ews-java-api</artifactId><version>2.0</version>
</dependency>
<dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional>
</dependency>

配置文件email.properties内容如下:

# Exchange邮箱配置
email.exchange.username=发件人邮箱
email.exchange.password=发件人邮箱密码
email.exchange.server=邮箱服务器地址

 工具类代码如下:

package com.utils;import lombok.extern.slf4j.Slf4j;
import microsoft.exchange.webservices.data.core.ExchangeService;
import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
import microsoft.exchange.webservices.data.core.exception.service.local.ServiceLocalException;
import microsoft.exchange.webservices.data.core.service.item.EmailMessage;
import microsoft.exchange.webservices.data.credential.ExchangeCredentials;
import microsoft.exchange.webservices.data.credential.WebCredentials;
import microsoft.exchange.webservices.data.property.complex.MessageBody;import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;@Slf4j
public class ExchangeClient {private static final Properties PROPERTIES = new Properties();static {try {loadProperties();} catch (IOException e) {e.printStackTrace();}}private static void loadProperties() throws IOException {try (InputStream input = ExchangeClient.class.getClassLoader().getResourceAsStream("email.properties")) {PROPERTIES.load(input);}}private static String getProperty(String key) {return PROPERTIES.getProperty(key);}private final String hostname = getProperty("email.exchange.server");private final String username = getProperty("email.exchange.username");private final String password = getProperty("email.exchange.password");private final ExchangeVersion exchangeVersion;private final String domain;private final String subject;private final String recipientTo;private final List<String> recipientCc;private final List<String> recipientBcc;private final List<String> attachments;private final String message;private ExchangeClient(ExchangeClientBuilder builder) {this.exchangeVersion = builder.exchangeVersion;this.domain = builder.domain;this.subject = builder.subject;this.recipientTo = builder.recipientTo;this.recipientCc = builder.recipientCc;this.recipientBcc = builder.recipientBcc;this.attachments = builder.attachments;this.message = builder.message;}public static class ExchangeClientBuilder {private String hostname;private ExchangeVersion exchangeVersion;private String domain;private String username;private String password;private String subject;private String recipientTo;private List<String> recipientCc;private List<String> recipientBcc;private List<String> attachments;private String message;public ExchangeClientBuilder() {this.exchangeVersion = ExchangeVersion.Exchange2010_SP1;this.hostname = "";this.username = "";this.password = "";this.subject = "";this.recipientTo = "";this.recipientCc = new ArrayList<>(0);this.recipientBcc = new ArrayList<>(0);this.attachments = new ArrayList<>(0);this.message = "";}/*** The hostname of the Exchange Web Service. It will be used for* connecting with URI https://hostname/ews/exchange.asmx** @param hostname the hostname of the MS Exchange Smtp Server.* @return the builder for chain usage.*/public ExchangeClientBuilder hostname(String hostname) {this.hostname = hostname;return this;}/*** The Exchange Web Server version.** @param exchangeVersion the Exchange Web Server version.* @return the builder for chain usage.*/public ExchangeClientBuilder exchangeVersion(ExchangeVersion exchangeVersion) {this.exchangeVersion = exchangeVersion;return this;}/*** The domain of the MS Exchange Smtp Server.** @param domain the domain of the Active Directory. The first part of*               the username. For example: MYDOMAIN\\username, set the MYDOMAIN.* @return the builder for chain usage.*/public ExchangeClientBuilder domain(String domain) {this.domain = domain;return this;}/*** The username of the MS Exchange Smtp Server. The second part of the* username. For example: MYDOMAIN\\username, set the username.** @param username the username of the MS Exchange Smtp Server.* @return the builder for chain usage.*/public ExchangeClientBuilder username(String username) {this.username = username;return this;}/*** The password of the MS Exchange Smtp Server.** @param password the password of the MS Exchange Smtp Server.* @return the builder for chain usage.*/public ExchangeClientBuilder password(String password) {this.password = password;return this;}/*** The subject for this send.** @param subject the subject for this send.* @return the builder for chain usage.*/public ExchangeClientBuilder subject(String subject) {this.subject = subject;return this;}/*** The recipient for this send.** @param recipientTo the recipient for this send.* @return the builder for chain usage.*/public ExchangeClientBuilder recipientTo(String recipientTo) {this.recipientTo = recipientTo;return this;}/*** You can specify one or more email address that will be used as cc* recipients.** @param recipientCc  the first cc email address.* @param recipientsCc the other cc email address for this send.* @return the builder for chain usage.*/public ExchangeClientBuilder recipientCc(String recipientCc, String... recipientsCc) {// Prepare the list.List<String> recipients = new ArrayList<>(1 + recipientsCc.length);recipients.add(recipientCc);recipients.addAll(Arrays.asList(recipientsCc));// Set the list.this.recipientCc = recipients;return this;}/*** You can specify a list with email addresses that will be used as cc* for this email send.** @param recipientCc the list with email addresses that will be used as*                    cc for this email send.* @return the builder for chain usage.*/public ExchangeClientBuilder recipientCc(List<String> recipientCc) {this.recipientCc = recipientCc;return this;}/*** You can specify one or more email address that will be used as bcc* recipients.** @param recipientBcc  the first bcc email address.* @param recipientsBcc the other bcc email address for this send.* @return the builder for chain usage.*/public ExchangeClientBuilder recipientBcc(String recipientBcc, String... recipientsBcc) {// Prepare the list.List<String> recipients = new ArrayList<>(1 + recipientsBcc.length);recipients.add(recipientBcc);recipients.addAll(Arrays.asList(recipientsBcc));// Set the list.this.recipientBcc = recipients;return this;}/*** You can specify a list with email addresses that will be used as bcc* for this email send.** @param recipientBcc the list with email addresses that will be used*                     as bcc for this email send.* @return the builder for chain usage.*/public ExchangeClientBuilder recipientBcc(List<String> recipientBcc) {this.recipientBcc = recipientBcc;return this;}/*** You can specify one or more email address that will be used as cc* recipients.** @param attachment  the first attachment.* @param attachments the other attachments for this send.* @return the builder for chain usage.*/public ExchangeClientBuilder attachments(String attachment, String... attachments) {// Prepare the list.List<String> attachmentsToUse = new ArrayList<>(1 + attachments.length);attachmentsToUse.add(attachment);attachmentsToUse.addAll(Arrays.asList(attachments));// Set the list.this.attachments = attachmentsToUse;return this;}/*** You can specify a list with email attachments that will be used for* this email send.** @param attachments the list with email attachments that will be used*                    for this email send.* @return the builder for chain usage.*/public ExchangeClientBuilder attachments(List<String> attachments) {this.attachments = attachments;return this;}/*** The body of the email message.** @param message the body of the email message.* @return the builder for chain usage.*/public ExchangeClientBuilder message(String message) {this.message = message;return this;}/*** Build a mail.** @return an EmailApacheUtils object.*/public ExchangeClient build() {return new ExchangeClient(this);}}public boolean sendExchange() {// The Exchange Server Version.ExchangeService exchangeService = new ExchangeService(exchangeVersion);// Credentials to sign in the MS Exchange Server.ExchangeCredentials exchangeCredentials = new WebCredentials(username, password, domain);exchangeService.setCredentials(exchangeCredentials);// URL of exchange web service for the mailbox.try {exchangeService.setUrl(new URI("https://" + hostname + "/ews/Exchange.asmx"));} catch (URISyntaxException ex) {log.info("An exception occured while creating the uri for exchange service.", ex);return false;}// The email.EmailMessage emailMessage;try {emailMessage = new EmailMessage(exchangeService);emailMessage.setSubject(subject);emailMessage.setBody(MessageBody.getMessageBodyFromText(message));} catch (Exception ex) {log.info("An exception occured while setting the email message.", ex);return false;}// TO recipient.try {emailMessage.getToRecipients().add(recipientTo);} catch (ServiceLocalException ex) {log.info("An exception occured while sstting the TO recipient(" + recipientTo + ").", ex);return false;}// CC recipient.for (String recipient : recipientCc) {try {emailMessage.getCcRecipients().add(recipient);} catch (ServiceLocalException ex) {log.info("An exception occured while sstting the CC recipient(" + recipient + ").", ex);return false;}}// BCC recipientfor (String recipient : recipientBcc) {try {emailMessage.getBccRecipients().add(recipient);} catch (ServiceLocalException ex) {log.info("An exception occured while sstting the BCC recipient(" + recipient + ").", ex);return false;}}// Attachements.for (String attachmentPath : attachments) {try {emailMessage.getAttachments().addFileAttachment(attachmentPath);} catch (ServiceLocalException ex) {log.info("An exception occured while setting the attachment.", ex);return false;}}try {emailMessage.send();log.info("An email is send.");} catch (Exception ex) {log.info("An exception occured while sending an email.", ex);return false;}return true;}}

调用代码如下:

 public static void main(String[] args) {ExchangeClient exchangeClient = new ExchangeClient.ExchangeClientBuilder().exchangeVersion(ExchangeVersion.Exchange2010).recipientTo("收件人邮箱").recipientCc("抄送人邮箱1", "抄送人邮箱2").recipientBcc("密送人邮箱").subject("邮件主题").message("邮件内容").build();boolean sendExchange = exchangeClient.sendExchange();System.err.println("send result:" + sendExchange);}

相关文章:

微软exchange邮箱发送

使用java发送exchange类型的邮件&#xff0c;foxmail中配置如下图&#xff1a; 需要的maven依赖如下&#xff1a; <dependency><groupId>com.microsoft.ews-java-api</groupId><artifactId>ews-java-api</artifactId><version>2.0</ve…...

AI绘画Stable Diffusion SDXL 超赞!高质量万能大模型,写实人像、时尚设计、建筑设计、电影制作—筑梦工业XLV4.0

大家好&#xff0c;我是阿威 今天为大家带来了一款多功能大模型——Dream Tech XL | 筑梦工业XL V4.0。该模型是大佬Dr_Dream基于V3.0训练而来的迭代版本&#xff0c;在提升画面质感的同时&#xff0c;对于提示词理解能力有跨越式提升&#xff0c;可以做到100%还原提示词。筑梦…...

数字人捕捉、建模与合成

在感知系统中&#xff0c;我们与外部合作者一起创建逼真的 3D 人类&#xff0c;其行为可以像虚拟世界中的真实人类一样。这项工作在今天有许多实际应用&#xff0c;并且对于元宇宙的未来至关重要。但是&#xff0c;在感知系统中&#xff0c;我们的目标是科学的——通过重现人类…...

Yarn:下一代JavaScript包管理器的安装与实战指南

当然&#xff0c;让我们深入探讨Yarn——一个高效、可靠的JavaScript包管理器&#xff0c;它为前端开发带来了新的速度和便利。Yarn由Facebook、Google、Exponent和Tilde公司共同推出&#xff0c;旨在解决npm&#xff08;Node.js包管理器&#xff09;存在的问题&#xff0c;如依…...

JVM进程缓存 Caffeine

JVM进程缓存 Caffeine 初识Caffeine Caffeine是一个基于Java8开发的&#xff0c;提供了近乎最佳命中率的高性能的本地缓存库。 ben-manes/caffeine: A high performance caching library for Java (github.com) 实例代码 Test void testBasicOps() {// 创建缓存对象Cache&…...

c++ 线程交叉场景试验

1.需求 处理一个列表的数据&#xff0c;要求按照列表的数据处理10个数据可以使用多线程处理&#xff0c;但是针对每个线程&#xff0c;1~10的处理顺序不能变。每个数据的处理必须原子&#xff0c;即只有一个线程可以针对某个数据进行处理&#xff0c;但是10个数据是可以由10个…...

Cell:如何升华你的单细胞数据——PCF空间单细胞蛋白组联合scRNA-seq解析骨髓微环境

骨髓微环境非常复杂&#xff0c;含有不同的细胞类型&#xff0c;包括了造血、间充质、内皮、血管平滑肌和神经谱系细胞等。非造血细胞对于骨髓造血非常关键。然而&#xff0c;这些细胞在人骨髓中的异质性和空间定位在很大程度上仍未被表征。来自佩雷尔曼医学院的研究者使用scRN…...

vue强制刷新组件

在Vue中强制刷新一个组件&#xff0c;通常不是一个推荐的做法&#xff0c;因为Vue的响应式系统设计就是为了自动处理依赖的更新。要强制重新渲染组件&#xff0c;以下是几种方法&#xff1a; 使用key属性&#xff1a; 最常见的方法是改变组件的key属性。当key发生变化时&#x…...

分享5款对工作学习有帮助的效率软件

​ 今天再来推荐5个超级好用的效率软件&#xff0c;无论是对你的学习还是办公都能有所帮助&#xff0c;每个都堪称神器中的神器&#xff0c;用完后觉得不好用你找我。 1.文件复制——ClipClip ​ ClipClip是一款功能强大、操作简便的文件复制与管理软件。它改变了传统的复制粘…...

redis秒杀(PHP版本)

前提提要 今天产品端提了个需求&#xff0c;院校组要求借调我去帮忙&#xff0c;因为我以前做过商城&#xff0c;现在他们需求做一个积分商城&#xff0c;需要做一个秒杀模块&#xff0c;结果毫无意外的我被借调过去了&#xff0c;刚好可以复习一下以前的知识&#xff0c;现在介…...

图形用户界面(GUI)在AI去衣技术中的作用与重要性

引言&#xff1a; 随着人工智能技术的不断进步&#xff0c;AI去衣这一概念逐渐进入公众视野。它指的是利用深度学习算法&#xff0c;从图片或视频中自动移除人物的衣物&#xff0c;生成相应的“裸体”图像。尽管这项技术在道德和隐私方面引发了诸多争议&#xff0c;但其背后的技…...

如何阅读:一个已被证实的低投入高回报的学习方法的笔记

系列文章目录 如何有效阅读一本书笔记 如何阅读&#xff1a;一个已被证实的低投入高回报的学习方法 麦肯锡精英高效阅读法笔记 读懂一本书笔记 文章目录 系列文章目录第一章 扫清阅读障碍破解读不快、读不进去的谜题一切为了阅读小学教师让你做&#xff0c;但中学老师阻止你做的…...

pycharm 安装“通义灵码“并测试

过程&#xff1a;“File>setting>Plugins” 提示&#xff1a; 翻译之后&#xff1a; 点击"接受"之后&#xff0c;提示一下图片&#xff0c;点击ok 安装完成&#xff1a; 安装完"通义灵码"之后&#xff0c;需要登陆&#xff0c;登陆后测试 参考…...

React 之 useMemo Hook (九)

useMemo 是 React 的一个Hook&#xff0c;它允许你“记住”一些计算值&#xff0c;只有在依赖项之一发生变化时才会重新计算这些值。这有助于避免不必要的重新计算和渲染&#xff0c;从而提高应用程序的性能。 代码栗子&#xff08;计算一个斐波那契数列的值&#xff09;&#…...

短视频矩阵系统源码saas开发--可视化剪辑、矩阵托管、多功能合一开发

短视频矩阵系统源码saas开发&#xff08;可视化剪辑、矩阵托管、智能私信聚合、线索转化、数据看板、seo关键词、子账号等多个板块开发&#xff09; 短视频矩阵系统是一种集成了多种功能的系统&#xff0c;旨在帮助用户在短视频平台上进行高效的内容创作、管理和发布。根据您提…...

百度大模型文心一言api 请求错误码 一览表

错误码说明 千帆大模型平台API包含两类&#xff0c;分别为大模型能力API和大模型平台管控API&#xff0c;具体细分如下&#xff1a; 大模型能力API 对话Chat续写Completions向量Embeddings图像Images 大模型平台管控API 模型管理Prompt工程服务管理模型精调数据管理TPM&RP…...

Unity调用智谱API(简单操作 文本实时翻译)

代码展示&#xff1a; using Newtonsoft.Json; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI;public class ZhiPuAi : MonoBehaviour {// API的端点URLpublic string…...

Android 开机启动扫描SD卡apk流程源码分析

在开机的时候&#xff0c;装在SD卡的apk和装在系统盘的apk扫描过程不一样&#xff0c;系统盘apk在系统启动过程中扫描&#xff0c;而SD卡上的就不是&#xff0c;等系统启动好了才挂载、扫描&#xff0c;下面就说下SD扫描的流程&#xff1a; 在SystemServer启动MountService&am…...

如何恢复回收站中被删除的文件?3个恢复策略,实测有用!

“刚刚一不小心把回收站清空了&#xff0c;大家有什么好用的方法可以帮我恢复回收站中删除的文件吗&#xff1f;快帮帮我吧&#xff01;” 在使用电脑的过程中&#xff0c;我们有时可能会不小心将重要的文件或文件夹删除到回收站&#xff0c;并且随后可能进一步从回收站中彻底删…...

Unity---版本控制软件

13.3 版本控制——Git-1_哔哩哔哩_bilibili Git用的比较多 Git 常用Linux命令 pwd&#xff1a;显示当前所在路径 ls&#xff1a;显示当前路径下的所有文件 tab键自动补全 cd&#xff1a;切换路径 mkdir&#xff1a;在当前路径下创建一个文件夹 clear&#xff1a;清屏 vim…...

基于大模型的idea提炼:围绕论文和引用提炼idea之ResearchAgent

前言 对本博客比较熟悉的朋友知道&#xff0c;我司论文项目组正在基于大模型做论文的审稿(含CS英文论文审稿、和金融中文论文审稿)、翻译&#xff0c;且除了审稿翻译之外&#xff0c;我们还将继续做润色/修订、idea提炼(包含论文检索)&#xff0c;是一个大的系统&#xff0c;包…...

前端深度扩展

1 为什么要有webpack 模块化管理&#xff1a;构建工具支持Common JS、ES6模块等规范&#xff1b;依赖管理&#xff1a;在大型项目中&#xff0c;手动管理文件依赖关系。webpack可以自动分析项目中的依赖关系&#xff0c;将其打包成1个或多个优化过的文件&#xff0c;减少页面加…...

雷军-2022.8小米创业思考-6-互联网七字诀之专注:有所为,有所不为;克制贪婪,少就是多;一次解决一个最迫切的需求

第六章 互联网七字诀 专注、极致、口碑、快&#xff0c;这就是我总结的互联网七字诀&#xff0c;也是我对互联网思维的高度概括。 专注 从商业角度看&#xff0c;专注就是要“把鸡蛋尽量放在一个篮子里”。这听起来似乎有些不合理&#xff0c;大家的第一反应可能是“风险会不会…...

【禅道客户案例】北大软件携手禅道,开启产品化之路新征程

在项目制项目模式下&#xff0c;软件公司根据客户的需求进行短期项目开发&#xff0c;具有灵活、高效、受众面广的优点&#xff0c;在业界得到了广泛的应用。但这种模式也面临诸多挑战&#xff0c;软件公司需要不断地开发新项目来维持业务增长&#xff0c;由于没有自己的产品也…...

解释泛型(Generics)在Java中的用途

在Java中&#xff0c;泛型&#xff08;Generics&#xff09;是一种在编译时期提供类型检查和约束的机制&#xff0c;它使得类和接口可以被参数化&#xff0c;即你可以定义一个类或接口&#xff0c;并通过参数传入具体的类型。泛型增加了代码的复用性和类型安全性&#xff0c;同…...

给网站网页PHP页面设置密码访问代码

将MkEncrypt.php文件上传至你网站根目录下或者同级目录下。 MkEncrypt.php里面添加代码&#xff0c;再将调用代码添加到你需要加密的页进行调用 MkEncrypt(‘123456’);括号里面123456修改成你需要设置的密码。 密码正确才能进去页面&#xff0c;进入后会存下cookies值&…...

124.反转链表(力扣)

题目描述 代码解决&#xff08;思路1&#xff1a;双指针&#xff09; class Solution { public:ListNode* reverseList(ListNode* head) {ListNode*temp;//保存cur下一个节点ListNode*curhead;ListNode*preNULL;while(cur){tempcur->next;// 保存一下 cur的下一个节点&#…...

【数据库原理及应用】期末复习汇总高校期末真题试卷06

试卷 一、选择题 1&#xff0e; ________是长期存储在计算机内的有组织,可共享的数据集合. A.数据库管理系统 B.数据库系统 C.数据库 D.文件组织 1&#xff0e; 有12个实体类型&#xff0c;并且它们之间存在15个不同的二元联系&#xff0c;其中4个是1:1联系类型&#xff0c;5…...

Offline:IQL

ICLR 2022 Poster Intro 部分离线强化学习的对价值函数采用的是最小化均方bellman误差。而其中误差源自单步的TD误差。TD误差中对target Q的计算需要选取一个max的动作&#xff0c;这就容易导致采取了OOD的数据。因此&#xff0c;IQL取消max,&#xff0c;通过一个期望回归算子…...

图像涂哪就动哪!Gen-2新功能“神笔马良”爆火,网友:急急急

AI搞视频生成&#xff0c;已经进化到这个程度了&#xff1f;&#xff01; 对着一张照片随手一刷&#xff0c;就能让被选中的目标动起来&#xff01; 明明是一辆静止的卡车&#xff0c;一刷就跑了起来&#xff0c;连光影都完美还原&#xff1a; 原本只是一张火灾照片&#xff0…...