【发布时间】:2026-01-29 15:20:10
【问题描述】:
所以我正在构建一个电子邮件爆炸,并且对 HTML 特定的电子邮件爆炸相当陌生,我的图像和链接工作正常,但我的问题是在手机上查看爆炸时,我尝试嵌入的媒体查询是不工作。
我正在使用 ASP.NET 和 HTML 来执行爆炸。但我担心我可能包含了太多的 css 或者不足以根据屏幕调整身体的大小。
如果有人可以查看我的代码并查看我可能出错的地方,我将不胜感激。
Dim emailmess As New MailMessage()
emailmess.From = New MailAddress("example@example.com")
emailmess.To.Add(New MailAddress("example@example.com"))
emailmess.IsBodyHtml = True
emailmess.Subject = "Aures Email Blast Test"
emailmess.Body = "<html><head><style type='text/css'>@media screen and (max-width:600px){table[class='container-table'] {width: 100% !important;}}</style></head><body margin='0' padding='0'><table class='container-table' cellspacing='0' cellpadding='0' style='max-width: 600px; width:100%; height:100%; max-height: 800px;' background='http://www.becub3d.com/Aures_Eblast_F.png'><tr><td><table class='container-table' cellspacing='0' cellpadding='0' border='0' cellspacing='0' cellpadding='0' style='margin-top:107%; max-width:600px; height:9%; width:100%;' ><tr><td align='left' style='width:42px;'></td><td style='width:100px;cursor:pointer;' ><a href='https://www.aures.com/en/Contact/main-aures-contact' style='display:block; text-decoration:none; height:70px;'> </a></td><td style='width:20px;'></td><td style='width:100px;cursor:pointer;' ><a href='https://www.youtube.com/watch?v=en_LPS_gfXY' style='display:block; text-decoration:none; height:70px;'> </a></td><td style='width:20px;'></td><td style='width:100px;cursor:pointer;' ><a href='https://www.aures.com/en/point-of-sale-equipment-solutions-systems/yuno-touchscreen-terminal-multi-configuration' style='display:block; text-decoration:none; height:70px;'> </a></td><td style='width:37px;'></td></tr></table><table class='container-table' cellspacing='0' cellpadding='0' width='600' height='30'><tr><td></td></tr></table><table class='container-table' cellspacing='0' cellpadding='0' width='600' height='10' border='0' cellspacing='0' cellpadding='0'><tr><td style='width:440px;'></td><td style='width:75px;cursor:pointer;' ><a href='www.auresusa.com' style='display:block; text-decoration:none;'> </a></td><td></td></tr></table><table class='container-table' cellspacing='0' cellpadding='0' width='600' height='16'><tr><td style='width:290px;'></td><td style='width:15px;cursor:pointer;' ><a href='https://www.linkedin.com/company/aures-technologies-inc' style='display:block; text-decoration:none;'> </a></td><td></td></tr></table></td></tr></table></body></html>"
Dim thesmtp As New SmtpClient("webmail.example.com")
thesmtp.Credentials = New System.Net.NetworkCredential("example@example.com", "password")
thesmtp.Port = 25
thesmtp.EnableSsl = False
thesmtp.Send(emailmess)
HTML 字符串在下面分解
<html>
<head>
<style type='text/css'>@media screen and (max-width:600px){table[class='container-table'] {width: 100% !important;}}</style>
</head>
<body margin='0' padding='0'>
<table class='container-table' cellspacing='0' cellpadding='0' style='max-width: 600px; width:100%; height:100%; max-height: 800px;' background='http://www.becub3d.com/Aures_Eblast_F.png'>
<tr>
<td>
<table class='container-table' cellspacing='0' cellpadding='0' border='0' cellspacing='0' cellpadding='0' style='margin-top:107%; max-width:600px; height:9%; width:100%;' >
<tr>
<td align='left' style='width:42px;'></td>
<td style='width:100px;cursor:pointer;' >
<a href='https://www.aures.com/en/Contact/main-aures-contact' style='display:block; text-decoration:none; height:70px;'> </a>
</td>
<td style='width:20px;'></td>
<td style='width:100px;cursor:pointer;' >
<a href='https://www.youtube.com/watch?v=en_LPS_gfXY' style='display:block; text-decoration:none; height:70px;'> </a>
</td>
<td style='width:20px;'></td>
<td style='width:100px;cursor:pointer;' >
<a href='https://www.aures.com/en/point-of-sale-equipment-solutions-systems/yuno-touchscreen-terminal-multi-configuration' style='display:block; text-decoration:none; height:70px;'> </a></td><td style='width:37px;'>
</td>
</tr>
</table>
<table class='container-table' cellspacing='0' cellpadding='0' width='600' height='30'>
<tr>
<td></td>
</tr>
</table>
<table class='container-table' cellspacing='0' cellpadding='0' width='600' height='10' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td style='width:440px;'></td>
<td style='width:75px;cursor:pointer;' >
<a href='www.auresusa.com' style='display:block; text-decoration:none;'> </a>
</td>
<td></td>
</tr>
</table>
<table class='container-table' cellspacing='0' cellpadding='0' width='600' height='16'>
<tr>
<td style='width:290px;'></td>
<td style='width:15px;cursor:pointer;' >
<a href='https://www.linkedin.com/company/aures-technologies-inc' style='display:block; text-decoration:none;'> </a>
</td>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
</body></html>
【问题讨论】:
-
我也查看了您的 HTML,似乎 HTML 中有一些错误。如果您在 HTML 编辑器中查看
HTML STRING BROKEN DOWN BELOW并查找第 9 行和第 30 行,您会发现 cellpadding 和 cellspacing 加倍。正如 Gwally 所说,编码电子邮件不像网络,你的 CSS 必须是内联的,图像应该在 HTML 中。我不建议使用完全基于图像的电子邮件,因为它可能会导致不同 EPS 的交付问题。如果您确实想发送基于图像的电子邮件,请将其分成几部分。
标签: html css asp.net html-email mail-server