首页 > 其他分享 >Abp vNext 使用邮件

Abp vNext 使用邮件

时间:2022-11-13 13:22:26浏览次数:79  
标签:vNext use Smtp settingDefinitionManager Abp Password settingEncryptionService 邮件

https://docs.abp.io/en/abp/latest/Emailing

Encrypt the SMTP Password
Abp.Mailing.Smtp.Password must be an encrypted value. If you use the ISettingManager to set the password, you don't have to worry. It internally encrypts the values on set and decrypts on get.

If you use the appsettings.json to store the password, you should manually inject the ISettingEncryptionService and use its Encrypt method to obtain an encrypted value. This can be done by creating a simple code in your application. Then you can delete the code. As better, you can create a UI in your application to configure the email settings. In this case, you can directly use the ISettingManager without worrying the encryption.

using Volo.Abp.Emailing;
using Volo.Abp.Settings;

namespace AbpManaul.Application.Settings;

public class SettingService
{
    private readonly ISettingEncryptionService _settingEncryptionService;
    private readonly ISettingDefinitionManager _settingDefinitionManager;

    public SettingService(
            ISettingEncryptionService settingEncryptionService,
            ISettingDefinitionManager settingDefinitionManager)
    {
        _settingEncryptionService = settingEncryptionService;
        _settingDefinitionManager = settingDefinitionManager;
    }

    public string EncryptMailingSmtpPassword(string passsword)
    {

        var setting = _settingDefinitionManager.Get(EmailSettingNames.Smtp.Password);
        var encryptPassword = _settingEncryptionService.Encrypt(setting, passsword);

        return encryptPassword;
    }
}

for example:

call EncryptMailingSmtpPassword(123) return "3zil2vJ325s+uboMEiKCDA=="
then set Abp.Mailing.Smtp.Password in the appsettings.json as following:

  "Settings": {
    ...
    "Abp.Mailing.Smtp.Password": "3zil2vJ325s+uboMEiKCDA==",
    ...
  },

标签:vNext,use,Smtp,settingDefinitionManager,Abp,Password,settingEncryptionService,邮件
From: https://www.cnblogs.com/easy5weikai/p/16885836.html

相关文章

  • Python 监控web站点异常邮件提醒并自动重启
    生产环境中站点,如邮于访问量大出现异常不能正常运行,一般可以通过重启解决的。我们可以尝试通过Python监控监控web站点异常,发送邮件通知并自动重启服务。本文主要介绍Python......
  • 邮件归档系统
    重要的邮件数据对企业发展尤为重要,如何才能保证邮件数据的信息安全?如何才能将重要的邮件数据永久保存也是目前企业比较关心的问题。关于邮件数据信息安全企业会遇到哪些常见......
  • 邮件工具类
    /***邮件工具类**@authorzj*@date2022/03/1416:39**/publicclassEMailUtil{/***创建简单的文本邮件**@paramsession......
  • python发送邮件
    python发送邮件封装#encoding=utf-8importsmtplibfromemail.mime.multipartimportMIMEMultipartfromemail.mime.textimportMIMETextclassEmailMange:......
  • 计算机网络应用层:HTTP和电子邮件
    计算机网络应用层应用层所讨论的对象可以简单理解为端系统上的网络应用程序。因特网网络体系结构分为5层:应用层、传输层、网络层、链路层、物理层。应用程序体系结构由应......
  • 【Zulip】邮件系统配置
    通过docker-compose(docker-zulip)部署Zulip实例时需要配置邮件系统SETTING_ZULIP_ADMINISTRATOR:'[email protected]'SETTING_EMAIL_HOST:'smtp.qq.com'S......
  • AI人脸检测/安全帽检测智能分析网关告警消息配置——邮件告警消息配置
    智能分析网关可支持对视频监控中的人脸、车辆、物体、行为等进行识别与抓拍、比对、告警,可提供人脸检测与识别、车辆检测与识别、烟火识别、区域入侵检测、安全帽检测、口......
  • AI人脸检测/安全帽检测智能分析网关告警消息配置——邮件告警消息配置
    智能分析网关可支持对视频监控中的人脸、车辆、物体、行为等进行识别与抓拍、比对、告警,可提供人脸检测与识别、车辆检测与识别、烟火识别、区域入侵检测、安全帽检测、口罩......
  • 使用 Django 发送邮件, 以及遇到的一些问题
    尝试了下使用Django发送邮件在setting.py中的配置#mailconfigEMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'EMAIL_HOST='smtp.qq.com'EM......
  • uniCloud云函数结合nodemailer发送邮件的方法
    使用uniCloud云函数结合nodemailer发送邮件的时候,在本地调试可以发送成功,但是当我把云函数上传后,就不能发送到邮件了,但是云函数依旧执行了。开始我以为是node.js版本的原因......