You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:无法找到Azure AD B2C邮件MFA验证模板自定义设置

Azure AD B2C邮件验证模板自定义解决方案

Azure AD B2C的邮件验证模板(包括MFA邮件)不在公司品牌设置中配置,需根据你使用的用户流类型选择对应方法:

一、内置用户流的限制

内置用户流仅支持修改邮件的文字内容,无法直接调整邮件样式(如顶部背景色、底部Logo)。若需自定义样式,需切换到自定义策略。

二、自定义策略实现完全自定义

通过自定义策略可以完全控制邮件模板的HTML内容,步骤如下:

  1. 打开你的Azure AD B2C自定义策略XML文件
  2. 找到负责发送验证邮件的<ClaimsProvider>节点(通常关联EmailVerification或PhoneFactorVerification)
  3. 在对应的<TechnicalProfile>中添加<Metadata>配置,指定自定义HTML模板:
    <TechnicalProfile Id="EmailVerification">
      <DisplayName>Email Verification</DisplayName>
      <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.EmailProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
      <Metadata>
        <!-- 保留原有元数据配置 -->
        <Item Key="HtmlTemplate">
          <![CDATA[
            <!DOCTYPE html>
            <html>
            <head>
              <style>
                .email-header { background-color: #2c3e50; padding: 24px; text-align: center; color: white; }
                .email-footer { margin-top: 40px; text-align: center; }
                .footer-logo { width: 120px; }
              </style>
            </head>
            <body>
              <div class="email-header">
                <h3>验证你的邮箱</h3>
              </div>
              <div style="padding: 20px; max-width: 600px; margin: 0 auto;">
                <p>请点击下方链接完成验证:</p>
                <p><a href="{VerificationLink}" style="color: #3498db;">{VerificationLink}</a></p>
              </div>
              <div class="email-footer">
                <img src="https://your-brand-domain.com/logo.png" class="footer-logo" alt="你的品牌标志">
              </div>
            </body>
            </html>
          ]]>
        </Item>
      </Metadata>
      <!-- 保留原有技术配置 -->
    </TechnicalProfile>
    
  4. 替换代码中的#2c3e50为你需要的顶部背景色,https://your-brand-domain.com/logo.png为你的品牌标志URL,务必保留{VerificationLink}占位符(B2C会自动替换为验证链接)
  5. 保存并上传更新后的自定义策略到Azure AD B2C租户

三、第三方SMTP服务替代方案

如果使用自有SMTP服务器发送验证邮件,可直接在SMTP服务端配置自定义邮件模板,完全控制邮件样式和内容,无需修改B2C策略。

内容的提问来源于stack exchange,提问作者Jason Susanto

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 04:00:07