Azure 函数使用 sendgrid 发送带有徽标的电子邮件

Azure functions to send email with logo using sendgrid

我正在使用 python 和 sendgrid 从 Azure 函数发送电子邮件。我能够形成电子邮件的另一部分,但是当我尝试在电子邮件的签名中插入徽标时,它没有显示出来。其余 HTML 渲染正常。(直到 href)

以下是我的代码:

    import sendgrid
    from sendgrid import SendGridAPIClient
    from sendgrid.helpers.mail import Mail

    message = Mail(
                        from_email=email_from,
                        to_emails=email_to, 
                        subject=email_subject,

                        html_content= '<br>Hi '+name+ ','+
                        '<br>body of the email. Working fine.' +
                        '<br><a href='+no+'>No'</a>\n' +
                        '<br><br>LOGO--><img src="doc.png" alt="W3Schools.com"/>'+
                        '</html>'
                            )
    response = sg.send(message)
    print(response.status_code)

我也尝试在 src 中指出 URL 但没有帮助。

有 3 个选项可以实现:

  • CID 嵌入图像(内联图像)
  • 内联嵌入(Base64 编码)
  • 链接图像

查看以下链接了解实施细节: