【问题标题】:Sending Image with center Text in it in Email在电子邮件中发送带有中心文本的图像
【发布时间】:2018-02-01 08:37:42
【问题描述】:

发送电子邮件的代码:

MailAddress addressFrom = new MailAddress("jack.du@e-iceblue.com", "Jack Du");
MailAddress addressTo = new MailAddress("susanwong32@outlook.com");
MailMessage message = new MailMessage(addressFrom, addressTo);

message.Date = DateTime.Now;
message.Subject = "Sending Email with HTML Body";
string htmlString = **my html code her to string convert**
                   ;   
message.BodyHtml = htmlString;

SmtpClient client= new SmtpClient();
client.Host = "smtp.outlook.com";
client.Port = 587;
client.Username = addressFrom.Address;
client.Password = "password";
client.ConnectionProtocols = ConnectionProtocols.Ssl;
client.SendOne(message);

Console.WriteLine("Sent Successfully!");
Console.Read();

我需要使用 Visual Basic .Net 发送电子邮件

问题 发送电子邮件后,我的邮箱有 我的文字显示在我的图片下方,而下面的 html 代码显示工作正常

点击查看我的html code

【问题讨论】:

  • 对于电子邮件,您需要使用表格和内联 CSS 对其进行编码。某些电子邮件客户端(例如 Outlook)不喜欢 div。拥有内联 CSS 和表格后,您的电子邮件将正常工作。
  • @Syfer 谢谢我正在检查它..

标签: html vb.net email


【解决方案1】:

我将只使用容器样式中的背景图片,如下

.container {
    position: relative;
    background: url('https://media.wmagazine.com/photos/585353e0d3b7a5db18f3a866/master/h_600,c_limit/GettyImages-105726097_master.jpg');
    text-align: center;
    color: orange;
    border: 1px solid #0d9ecf;
     width: 437px;
    height: 600px;
}

而不是使用<img> 标签。

【讨论】:

  • 请检查它,因为它在 html 中显示正常,但在电子邮件中显示错误
  • 对电子邮件背景图像的支持非常不完整。例如,背景图像在 Outlook 2007 及更高版本中不起作用。
  • 我尝试将它发送到 Hotmail,如果显示在 Hotmail 中,它可以工作。在 Outlook 中它可能会失败。最好的办法是在附加到邮件之前将文本直接写入图像。 stackoverflow.com/questions/6826921/…
猜你喜欢
  • 2011-12-27
  • 2013-06-01
  • 1970-01-01
  • 2012-04-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-27
相关资源
最近更新 更多