国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

SpringBoot整合郵件服務(wù)

這篇具有很好參考價(jià)值的文章主要介紹了SpringBoot整合郵件服務(wù)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

SpringBoot整合郵件服務(wù)

發(fā)送郵件應(yīng)該是網(wǎng)站的必備功能之一,什么注冊驗(yàn)證,忘記密碼或者是給用戶發(fā)送營銷信息。最早期的時候我們會

使用 JavaMail 相關(guān) api 來寫發(fā)送郵件的相關(guān)代碼,后來 Spring 推出了 JavaMailSender 更加簡化了郵件發(fā)送的過

程,在之后 Spring Boot 對此進(jìn)行了封裝就有了現(xiàn)在的 spring-boot-starter-mail ,本章文章的介紹主要來自

于此包。

1、簡單使用

1.1 pom依賴

pom 包里面添加 spring-boot-starter-mail 包引用

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
        <relativePath/>
    </parent>

    <groupId>com.example</groupId>
    <artifactId>spring-boot-mail</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-boot-mail</name>
    <description>spring-boot-mail</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>RELEASE</version>
        </dependency>

        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>RELEASE</version>
        </dependency>

        <!-- 模板引擎 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

1.2 在 application.properties 中添加郵箱配置

spring.application.name=spirng-boot-mail
# 郵箱服務(wù)器地址
spring.mail.host=smtp.163.com
# 用戶名
spring.mail.username=15110820283@163.com
# 密碼
spring.mail.password=EVNCPVURUPIFNAXG
spring.mail.default-encoding=UTF-8
# 誰來發(fā)送郵件
mail.fromMail.addr=15110820283@163.com

1.3 編寫 mailService

package com.example.service;

public interface MailService {

    void sendSimpleMail(String to, String subject, String content);

    void sendHtmlMail(String to, String subject, String content);

    void sendAttachmentsMail(String to, String subject, String content, String filePath);

    void sendInlineResourceMail(String to, String subject, String content, String rscPath, String rscId);

}
package com.example.service.impl;

import com.example.service.MailService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Component;

import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.io.File;

@Component
public class MailServiceImpl implements MailService {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private JavaMailSender mailSender;

    @Value("${mail.fromMail.addr}")
    private String from;

    /**
     * 發(fā)送文本郵件
     *
     * @param to
     * @param subject
     * @param content
     */
    @Override
    public void sendSimpleMail(String to, String subject, String content) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom(from);
        message.setTo(to);
        message.setSubject(subject);
        message.setText(content);
        try {
            mailSender.send(message);
            logger.info("簡單郵件已經(jīng)發(fā)送。");
        } catch (Exception e) {
            logger.error("發(fā)送簡單郵件時發(fā)生異常!", e);
        }
    }

    /**
     * 發(fā)送html郵件
     *
     * @param to
     * @param subject
     * @param content
     */
    @Override
    public void sendHtmlMail(String to, String subject, String content) {
        MimeMessage message = mailSender.createMimeMessage();
        try {
            // true表示需要創(chuàng)建一個multipart message
            MimeMessageHelper helper = new MimeMessageHelper(message, true);
            helper.setFrom(from);
            helper.setTo(to);
            helper.setSubject(subject);
            helper.setText(content, true);
            mailSender.send(message);
            logger.info("html郵件發(fā)送成功");
        } catch (MessagingException e) {
            logger.error("發(fā)送html郵件時發(fā)生異常!", e);
        }
    }

    /**
     * 發(fā)送帶附件的郵件
     *
     * @param to
     * @param subject
     * @param content
     * @param filePath
     */
    @Override
    public void sendAttachmentsMail(String to, String subject, String content, String filePath) {
        MimeMessage message = mailSender.createMimeMessage();
        try {
            MimeMessageHelper helper = new MimeMessageHelper(message, true);
            helper.setFrom(from);
            helper.setTo(to);
            helper.setSubject(subject);
            helper.setText(content, true);

            FileSystemResource file = new FileSystemResource(new File(filePath));
            String fileName = filePath.substring(filePath.lastIndexOf(File.separator));
            helper.addAttachment(fileName, file);
            //helper.addAttachment("test"+fileName, file);

            mailSender.send(message);
            logger.info("帶附件的郵件已經(jīng)發(fā)送。");
        } catch (MessagingException e) {
            logger.error("發(fā)送帶附件的郵件時發(fā)生異常!", e);
        }
    }


    /**
     * 發(fā)送正文中有靜態(tài)資源(圖片)的郵件
     *
     * @param to
     * @param subject
     * @param content
     * @param rscPath
     * @param rscId
     */
    @Override
    public void sendInlineResourceMail(String to, String subject, String content, String rscPath, String rscId) {
        MimeMessage message = mailSender.createMimeMessage();
        try {
            MimeMessageHelper helper = new MimeMessageHelper(message, true);
            helper.setFrom(from);
            helper.setTo(to);
            helper.setSubject(subject);
            helper.setText(content, true);
            FileSystemResource res = new FileSystemResource(new File(rscPath));
            helper.addInline(rscId, res);
            mailSender.send(message);
            logger.info("嵌入靜態(tài)資源的郵件已經(jīng)發(fā)送。");
        } catch (MessagingException e) {
            logger.error("發(fā)送嵌入靜態(tài)資源的郵件時發(fā)生異常!", e);
        }
    }
}

1.4 啟動類

package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

    public static void main(String[] args) {

        SpringApplication.run(Application.class, args);
    }

}

1.5 編寫test類進(jìn)行測試

package com.example.service;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;

@RunWith(SpringRunner.class)
@SpringBootTest
public class MailServiceTest {

    @Autowired
    private MailService mailService;

    @Autowired
    private TemplateEngine templateEngine;

    // 郵件發(fā)送到2420309401@qq.com,郵件標(biāo)題test simple mail,內(nèi)容文本內(nèi)容
    @Test
    public void testSimpleMail() throws Exception {
        mailService.sendSimpleMail("2420309401@qq.com","test simple mail"," hello this is simple mail");
    }

    // 郵件發(fā)送到2420309401@qq.com,郵件標(biāo)題test simple mail,內(nèi)容為html格式的內(nèi)容
    @Test
    public void testHtmlMail() throws Exception {
        String content="<html>\n" +
                "<body>\n" +
                "    <h3>hello world ! 這是一封html郵件!</h3>\n" +
                "</body>\n" +
                "</html>";
        mailService.sendHtmlMail("2420309401@qq.com","test simple mail",content);
    }

    // 郵件發(fā)送到2420309401@qq.com,郵件標(biāo)題test simple mail,內(nèi)容為文本內(nèi)容,帶附件
    @Test
    public void sendAttachmentsMail() {
        String filePath="C:\\Users\\Administrator\\Pictures\\Camera Roll\\img19.jpg";
        mailService.sendAttachmentsMail("2420309401@qq.com", "主題:帶附件的郵件", "有附件,請查收!", filePath);
    }

    // 郵件發(fā)送到2420309401@qq.com,郵件標(biāo)題test simple mail,內(nèi)容為文本內(nèi)容,發(fā)送正文中有靜態(tài)資源(圖片)的郵件
    @Test
    public void sendInlineResourceMail() {
        String rscId = "neo006";
        String content="<html><body>這是有圖片的郵件:<img src=\'cid:" + rscId + "\' ></body></html>";
        String imgPath = "C:\\Users\\Administrator\\Pictures\\Camera Roll\\img19.jpg";
        mailService.sendInlineResourceMail("2420309401@qq.com", "主題:這是有圖片的郵件", content, imgPath, rscId);
    }

    // 郵件發(fā)送到2420309401@qq.com,郵件標(biāo)題test simple mail,內(nèi)容為模板郵件
    @Test
    public void sendTemplateMail() {
        //創(chuàng)建郵件正文
        Context context = new Context();
        context.setVariable("id", "006");
        String emailContent = templateEngine.process("emailTemplate", context);
        mailService.sendHtmlMail("2420309401@qq.com","主題:這是模板郵件",emailContent);
    }
}
1.5.1 發(fā)送普通文本
package com.example.service;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.thymeleaf.TemplateEngine;

@RunWith(SpringRunner.class)
@SpringBootTest
public class MailServiceTest {

    @Autowired
    private MailService mailService;

    @Autowired
    private TemplateEngine templateEngine;

    // 郵件發(fā)送到2420309401@qq.com,郵件標(biāo)題test simple mail,內(nèi)容文本內(nèi)容
    @Test
    public void testSimpleMail() throws Exception {
        mailService.sendSimpleMail("2420309401@qq.com", "test simple mail", " hello this is simple mail");
    }
}

SpringBoot整合郵件服務(wù),spring boot,spring boot

SpringBoot整合郵件服務(wù),spring boot,spring boot

SpringBoot整合郵件服務(wù),spring boot,spring boot

但是在正常使用的過程中,我們通常在郵件中加入圖片或者附件來豐富郵件的內(nèi)容,下面講介紹如何使用 Spring

Boot 來發(fā)送豐富的郵件。

1.5.2 發(fā)送 html 格式郵件
package com.example.service;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.thymeleaf.TemplateEngine;

@RunWith(SpringRunner.class)
@SpringBootTest
public class MailServiceTest {

    @Autowired
    private MailService mailService;

    @Autowired
    private TemplateEngine templateEngine;

    // 郵件發(fā)送到2420309401@qq.com,郵件標(biāo)題test simple mail,內(nèi)容為html格式的內(nèi)容
    @Test
    public void testHtmlMail() throws Exception {
        String content = "<html>\n" +
                "<body>\n" +
                "    <h3>hello world ! 這是一封html郵件!</h3>\n" +
                "</body>\n" +
                "</html>";
        mailService.sendHtmlMail("2420309401@qq.com", "test simple mail", content);
    }
    
}

SpringBoot整合郵件服務(wù),spring boot,spring boot

SpringBoot整合郵件服務(wù),spring boot,spring boot

SpringBoot整合郵件服務(wù),spring boot,spring boot

1.5.3 發(fā)送帶附件的郵件
package com.example.service;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.thymeleaf.TemplateEngine;

@RunWith(SpringRunner.class)
@SpringBootTest
public class MailServiceTest {

    @Autowired
    private MailService mailService;

    @Autowired
    private TemplateEngine templateEngine;

    // 郵件發(fā)送到2420309401@qq.com,郵件標(biāo)題test simple mail,內(nèi)容為文本內(nèi)容,帶附件
    @Test
    public void sendAttachmentsMail() {
        String filePath = "C:\\Users\\Administrator\\Pictures\\Camera Roll\\img19.jpg";
        mailService.sendAttachmentsMail("2420309401@qq.com", "主題:帶附件的郵件", "有附件,請查收!", filePath);
    }
    
}

添加多個附件可以使用多條 helper.addAttachment(fileName, file)

SpringBoot整合郵件服務(wù),spring boot,spring boot

SpringBoot整合郵件服務(wù),spring boot,spring boot

SpringBoot整合郵件服務(wù),spring boot,spring boot

1.5.4 發(fā)送帶靜態(tài)資源的郵件

郵件中的靜態(tài)資源一般就是指圖片。

package com.example.service;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.thymeleaf.TemplateEngine;

@RunWith(SpringRunner.class)
@SpringBootTest
public class MailServiceTest {

    @Autowired
    private MailService mailService;

    @Autowired
    private TemplateEngine templateEngine;

    // 郵件發(fā)送到2420309401@qq.com,郵件標(biāo)題test simple mail,內(nèi)容為文本內(nèi)容,發(fā)送正文中有靜態(tài)資源(圖片)的郵件
    @Test
    public void sendInlineResourceMail() {
        String rscId = "neo006";
        String content = "<html><body>這是有圖片的郵件:<img src=\'cid:" + rscId + "\' ></body></html>";
        String imgPath = "C:\\Users\\Administrator\\Pictures\\Camera Roll\\img19.jpg";
        mailService.sendInlineResourceMail("2420309401@qq.com", "主題:這是有圖片的郵件", content, imgPath, rscId);
    }
    
}

添加多個圖片可以使用多條 <img src='cid:" + rscId + "' >helper.addInline(rscId, res) 來實(shí)現(xiàn)

SpringBoot整合郵件服務(wù),spring boot,spring boot

SpringBoot整合郵件服務(wù),spring boot,spring boot

SpringBoot整合郵件服務(wù),spring boot,spring boot

2、按照模板發(fā)送

郵件模板emailTemplate.html

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8"/>
        <title>Title</title>
    </head>
    <body>
        您好,這是驗(yàn)證郵件,請點(diǎn)擊下面的鏈接完成驗(yàn)證,<br/>
        <a href="#" th:href="@{ http://www.ityouknow.com/neo/{id}(id=${id}) }">激活賬號</a>
    </body>
</html>
package com.example.service;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;

@RunWith(SpringRunner.class)
@SpringBootTest
public class MailServiceTest {

    @Autowired
    private MailService mailService;

    @Autowired
    private TemplateEngine templateEngine;

    // 郵件發(fā)送到2420309401@qq.com,郵件標(biāo)題test simple mail,內(nèi)容為模板郵件
    @Test
    public void sendTemplateMail() {
        //創(chuàng)建郵件正文
        Context context = new Context();
        context.setVariable("id", "006");
        String emailContent = templateEngine.process("emailTemplate", context);
        mailService.sendHtmlMail("2420309401@qq.com", "主題:這是模板郵件", emailContent);
    }
}

SpringBoot整合郵件服務(wù),spring boot,spring boot

SpringBoot整合郵件服務(wù),spring boot,spring boot

SpringBoot整合郵件服務(wù),spring boot,spring boot

到此所有的郵件發(fā)送服務(wù)已經(jīng)完成了。

3、郵件系統(tǒng)

上面發(fā)送郵件的基礎(chǔ)服務(wù)就這些了,但是如果我們要做成一個郵件系統(tǒng)的話還需要考慮以下幾個問題:

3.1 郵件模板

我們會經(jīng)常收到這樣的郵件:

尊敬的neo用戶:
	恭喜您注冊成為xxx網(wǎng)的用戶,,同時感謝您對xxx的關(guān)注與支持并歡迎您使用xx的產(chǎn)品與服務(wù)。

其中只有 neo 這個用戶名在變化,其它郵件內(nèi)容均不變,如果每次發(fā)送郵件都需要手動拼接的話會不夠優(yōu)雅,并

且每次模板的修改都需要改動代碼的話也很不方便,因此對于這類郵件需求,都建議做成郵件模板來處理。模板的

本質(zhì)很簡單,就是在模板中替換變化的參數(shù),轉(zhuǎn)換為 html 字符串即可,這里以thymeleaf為例來演示。

1、pom 中導(dǎo)入 thymeleaf 的包

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

2、在resorces/templates下創(chuàng)建emailTemplate.html

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8"/>
        <title>Title</title>
    </head>
    <body>
        您好,這是驗(yàn)證郵件,請點(diǎn)擊下面的鏈接完成驗(yàn)證,<br/>
        <a href="#" th:href="@{ http://www.ityouknow.com/neo/{id}(id=${id}) }">激活賬號</a>
    </body>
</html>

3、解析模板并發(fā)送

@Test
public void sendTemplateMail() {
    //創(chuàng)建郵件正文
    Context context = new Context();
    context.setVariable("id", "006");
    String emailContent = templateEngine.process("emailTemplate", context);
    mailService.sendHtmlMail("2420309401@qq.com", "主題:這是模板郵件", emailContent);
}

3.2 發(fā)送失敗

因?yàn)楦鞣N原因,總會有郵件發(fā)送失敗的情況,比如:郵件發(fā)送過于頻繁、網(wǎng)絡(luò)異常等。在出現(xiàn)這種情況的時候,我

們一般會考慮重新重試發(fā)送郵件,會分為以下幾個步驟來實(shí)現(xiàn):

  • 1、接收到發(fā)送郵件請求,首先記錄請求并且入庫。

  • 2、調(diào)用郵件發(fā)送接口發(fā)送郵件,并且將發(fā)送結(jié)果記錄入庫。

  • 3、啟動定時系統(tǒng)掃描時間段內(nèi),未發(fā)送成功并且重試次數(shù)小于3次的郵件,進(jìn)行再次發(fā)送

3.3 異步發(fā)送

很多時候郵件發(fā)送并不是我們主業(yè)務(wù)必須關(guān)注的結(jié)果,比如通知類、提醒類的業(yè)務(wù)可以允許延時或者失敗。這個時

候可以采用異步的方式來發(fā)送郵件,加快主交易執(zhí)行速度,在實(shí)際項(xiàng)目中可以采用MQ發(fā)送郵件相關(guān)參數(shù),監(jiān)聽到

消息隊(duì)列之后啟動發(fā)送郵件。文章來源地址http://www.zghlxwxcb.cn/news/detail-624050.html

到了這里,關(guān)于SpringBoot整合郵件服務(wù)的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Mail 郵件服務(wù)

    Mail 郵件服務(wù)

    ~?Postfix ~? ?sdskill.com 的郵件發(fā)送服務(wù)器 ~~? ?支持smtps(465)協(xié)議連接,使用Rserver頒發(fā)的證書,證書路徑/CA/cacert.pem ~? ? 創(chuàng)建郵箱賬戶“user1~user99”(共99個用戶),密碼為Chinaskill20!; ~? ? Dovecot ~? ? sdskill.com 的郵件接收服務(wù)器; ~? ? 支持imaps(993)協(xié)議連接,使用Rserver頒發(fā)

    2023年04月26日
    瀏覽(23)
  • 一、Postfix[安裝與配置、smtp認(rèn)證、Python發(fā)送郵件以及防垃圾郵件方法、使用騰訊云郵件服務(wù)]

    一、Postfix[安裝與配置、smtp認(rèn)證、Python發(fā)送郵件以及防垃圾郵件方法、使用騰訊云郵件服務(wù)]

    Debian 11 apt install postfix 解釋:搭建真實(shí)的郵件服務(wù)器需要在DNS提供商那里配置下面的dns 配置A記錄 mail.www.com - 1.x.x.x 配置MX記錄 www.com - mail.www.com 解釋:按照上面的配置通常郵件格式就是 admin@www.com 其通過www.com的MX記錄找到mail.www.com再通過其A記錄來找到對應(yīng)服務(wù)器完成通訊 解

    2024年02月15日
    瀏覽(25)
  • 【服務(wù)器】搭建hMailServer 服務(wù)實(shí)現(xiàn)遠(yuǎn)程發(fā)送郵件

    【服務(wù)器】搭建hMailServer 服務(wù)實(shí)現(xiàn)遠(yuǎn)程發(fā)送郵件

    hMailServer 是一個郵件服務(wù)器,通過它我們可以搭建自己的郵件服務(wù),通過cpolar內(nèi)網(wǎng)映射工具即可實(shí)現(xiàn)遠(yuǎn)程發(fā)送郵件,不需要使用公網(wǎng)服務(wù)器,不需要域名,而且郵件賬號名稱可以自定義. 下面以windows 10系統(tǒng)為環(huán)境,介紹使用方法: 1. 安裝hMailServer 進(jìn)入官方下載:https://www.hmailserver.com/do

    2024年02月10日
    瀏覽(25)
  • 電子郵件服務(wù)器

    電子郵件服務(wù)器

    目錄 一、相關(guān)知識 二、郵件服務(wù)器種類 三、郵件傳輸協(xié)議 四、DNS中的MX記錄 五、電子郵件系統(tǒng)工作原理 六、配置文件相關(guān)參數(shù) 七、郵件服務(wù)器配置案例 7.1設(shè)置用戶別名郵箱 7.2空殼郵件服務(wù)器 一、相關(guān)知識 1、電子郵箱系統(tǒng)三個組成部分 MUA(telnet):郵件用戶代理。主要用

    2024年02月10日
    瀏覽(33)
  • 【服務(wù)端】CentOS Linux 7 搭建郵件服務(wù)器

    【服務(wù)端】CentOS Linux 7 搭建郵件服務(wù)器

    參考:CentOS7搭建簡單的郵件服務(wù)器 - 秋夜雨巷 - 博客園 (cnblogs.com) 在 CentOS7 中搭建郵件服務(wù)器,給QQ郵箱發(fā)郵件。簡單記錄一次搭建過程。 目錄 前言 一、基礎(chǔ)環(huán)境準(zhǔn)備 二、配置域名解析 1. 登錄阿里云 三、安裝郵件服務(wù) 1. 登錄主機(jī),配置yum源(配置阿里云yum源步驟略) 2

    2024年01月22日
    瀏覽(40)
  • 郵件服務(wù)器配置和管理

    郵件服務(wù)器配置和管理

    一臺安裝好的DNS服務(wù)器,ip為192.168.1.201 一臺郵件服務(wù)器,192.168.1.224 一臺客戶端,192.168.1.249,dnsIP為192.168.1.201 都是wmnet1,使其能互相ping通 1.打開DNS服務(wù)器,新建主機(jī) 把郵件服務(wù)器的主機(jī)添加上去,使得客戶端可以通過域名找到郵件服務(wù)器 1.用實(shí)體機(jī)進(jìn)入官網(wǎng)https://www.winma

    2024年03月19日
    瀏覽(30)
  • Spring Schedule:Spring boot整合Spring Schedule實(shí)戰(zhàn)講解定時發(fā)送郵件的功能

    Spring Schedule:Spring boot整合Spring Schedule實(shí)戰(zhàn)講解定時發(fā)送郵件的功能

    ???? 歡迎光臨,終于等到你啦 ???? ??我是 蘇澤 ,一位對技術(shù)充滿熱情的探索者和分享者。???? ??持續(xù)更新的專欄 《Spring 狂野之旅:從入門到入魔》 ?? 本專欄帶你從Spring入門到入魔 ? 這是蘇澤的個人主頁可以看到我其他的內(nèi)容哦???? 努力的蘇澤 http://suzee.blog.

    2024年03月14日
    瀏覽(22)
  • 使用CentOS 7配置郵件服務(wù)-第四篇

    使用CentOS 7配置郵件服務(wù)-第四篇

    在上一章我們配置主和從服務(wù)器的DNS域名解析,這一章我們配置使用CentOS 7配置郵件服務(wù) 要求: 1、兩臺郵件服務(wù)器IP地址分別為192.168.1.學(xué)號及192.168.0.199 2、 兩臺郵件服務(wù)器域名為學(xué)生姓名。例如mail.zhangsan.com 及mail.zs.com。 3、在DNS服務(wù)器配置兩臺服務(wù)器的域名。 4、配置完成

    2024年02月12日
    瀏覽(23)
  • 快速備份郵件到新服務(wù)器

    需求場景 自建郵局后,遇到了意料中的問題:遷移郵件到新郵局,即把原來郵箱里的郵件全部復(fù)制到新郵箱。 工具介紹 imapsync是一款強(qiáng)大的工具,用于同步兩個郵件服務(wù)器之間的數(shù)據(jù)。它支持IMAP協(xié)議,可以輕松地將郵件、文件夾、郵件標(biāo)記為已讀/已刪除等。使用imapsync,可

    2024年02月12日
    瀏覽(18)
  • 【node】nodemailer配置163、qq等郵件服務(wù)指南

    【node】nodemailer配置163、qq等郵件服務(wù)指南

    【node】發(fā)送郵件及附件簡要使用說明 參數(shù)配置參考如下: 郵箱服務(wù)提供商的要求,配置SMTP服務(wù)器的主機(jī)名、端口號和安全選項(xiàng)等細(xì)則如下: host:網(wǎng)易郵箱 | QQ 的SMTP服務(wù)器地址 port:端口,如果 secure 為 true,則端口為 465 secure:安全連接 auth:郵箱認(rèn)證 user:發(fā)送方郵箱的賬號

    2024年02月07日
    瀏覽(23)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包