wordpress动态链接301,百度seo优化,如何提高用户和网站的互动性,网页游戏开发软件我试图用Python发送一封带有多个图像附件的电子邮件。但是通过下面的代码#xff0c;我可以在正文中包含第一个图像#xff0c;但是第二个图像会作为附件附加到电子邮件中。有没有办法可以在HTML的主体中同时获得这两个图像#xff1f;下面是我当前的代码。在from email.mim…我试图用Python发送一封带有多个图像附件的电子邮件。但是通过下面的代码我可以在正文中包含第一个图像但是第二个图像会作为附件附加到电子邮件中。有没有办法可以在HTML的主体中同时获得这两个图像下面是我当前的代码。在from email.mime.multipart import MIMEMultipartfrom email.mime.text import MIMETextfrom email.mime.image import MIMEImagestrFrom userprovider.comstrTo userprovider.commsgRoot MIMEMultipart(related)msgRoot[Subject] Test messagemsgRoot[From] userprovider.commsgRoot[To] userprovider.commsgRoot.preamble This is a multi-part message in MIME format.msgAlternative MIMEMultipart(alternative)msgRoot.attach(msgAlternative)msgText MIMEText(This is the alternative plain text message.)msgAlternative.attach(msgText)msgText MIMEText(Test HTML with Images Sending Two Attachments, html)msgAlternative.attach(msgText)fp open(image1.png, rb)msgImage MIMEImage(fp.read())fp.close()msgImage.add_header(Content-ID, )msgRoot.attach(msgImage)fp open(image2.png, rb)msgImage2 MIMEImage(fp.read())fp.close()msgImage.add_header(Content-ID, )msgRoot.attach(msgImage2)import smtplibsmtp smtplib.SMTP(localhost)smtp.sendmail(strFrom, strTo, msgRoot.as_string())smtp.quit()