C# 使用css发送电子邮件时无法获取css
你有没有办法从c#asp.net发送一封带有css的html页面的电子邮件 目前我正在发送电子邮件,但当我在gmail中打开时,它没有捕获htmlpage中包含的cssC# 使用css发送电子邮件时无法获取css,c#,html,css,email,C#,Html,Css,Email,你有没有办法从c#asp.net发送一封带有css的html页面的电子邮件 目前我正在发送电子邮件,但当我在gmail中打开时,它没有捕获htmlpage中包含的css <html> <head> <meta charset="utf-8" /> <title></title> <style> body{ background-color:navy; color
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style>
body{
background-color:navy;
color:white;
font-family:Menulis;
margin-left:40px;
}
div {
margin:0 auto;
}
img{
border-radius:5px;
width:200px;
height:300px;
margin-right:200px;
display:block;
float:right;
}
</style>
</head>
<body>
<div>
<h1>User {user_email} Error Report</h1>
<p>The following error occured when user is trying to reset password
from pswrd_recover.aspx page:</p><br/>
<img src="https://pcappliancerepair.files.wordpress.com/2016/11
/38644550_m.jpg?w=585"/>
<p>{error_message}</p>
</div>
</body>
</html>
身体{
背景色:海军蓝;
颜色:白色;
字体系列:Menulis;
左边距:40px;
}
div{
保证金:0自动;
}
img{
边界半径:5px;
宽度:200px;
高度:300px;
右边距:200px;
显示:块;
浮动:对;
}
用户{User_email}错误报告
当用户试图重置密码时发生以下错误
从pswrd_recover.aspx页面:
{错误消息}
Gmail删除电子邮件HTML的整个标题。因此,它还将删除任何样式元素。
您需要内联CSS,如下所示:
<body style="background-color:navy; color:white;font-family:Menulis;margin-left:40px;">
<div style="margin:0 auto;">...</div>
<img style="border-radius:5px;width:200px;height:300px;margin-right:200px;display:block;float:right;" src="https://..." />
</body>
...
标签可以在
元素内部使用