无法将CSS添加到HTML代码中以从Mailkit发送电子邮件

问题描述 投票:0回答:1

我正在使用Mailkit在我的应用程序中发送电子邮件。有什么方法可以将CSS添加到HTML代码中来修饰电子邮件的正文。这是我要用于电子邮件正文的代码。

<div
    style="
      @import url('https://fonts.googleapis.com/css2?family=Varela+Round&display=swap');
      font-family: 'Varela Round', sans-serif;
      max-width: 600px;
      margin: 0 auto;
    "
  >
    <div
      style="
        width: 100%;
        height: 200px;
        border: solid 1px #cd5383;
        border-radius: 5px;
        padding: 5px;
        text-align: justify;
        font-size: 20px;
        line-height: 30px;
      "
    >
      Hello Manan, <br />
      We have received your request to change password in our Portal<br />
      <div style="text-align: center; margin-top: 10px;">
        <a target="_blank" href="https://www.google.com">
          <button
            style="
              font-family: 'Varela Round', sans-serif;
              width: 150px;
              height: 37px;
              margin-left: 10px;
              background-color: #cd5383;
              border: none;
              color: #fff;
              box-shadow: 1px 1px 5px 1px gray;
            "
          >
            Reset Password
          </button>
        </a>
      </div>
      <p style="font-size: 15px; text-align: center; color: gray;">
        Facing any issue, contact {[email protected]}
      </p>
    </div>
  </div>

Mailkit中有什么方法可以做到这一点?

html css asp.net-core mailkit
1个回答
0
投票

使用如下所示的内联CSS样式,我认为它会起作用。

© www.soinside.com 2019 - 2024. All rights reserved.