23

我的任务是为不同的电子邮件/网络邮件客户端优化 HTML 电子邮件。我曾经通过在 Outlook Express 中做一个技巧来测试 HTML 文件,让它发送原始 HTML,但微软现在似乎已经停止提供 Outlook Express(我认为“Live Mail”应该取代它)。

所以我的问题是,有没有一种简单、快速的方式来发送 HTML 电子邮件?也许甚至是一个可以完成这项工作的免费软件程序?

4

15 回答 15

20

Puts Mail是当今最好的选择。查看Puts Mail 的创建者对类似问题的回答。

于 2012-07-13T21:32:01.747 回答
4

我会使用 python,底部是一个示例,如何使用默认文本创建 HTML 电子邮件:http: //docs.python.org/library/email-examples.html 您可以对其进行参数化,封装在函数中,阅读来自文件等的内容(确保将“s = smtplib.SMTP('localhost')”中的 localhost 设置为 smtp 服务器)

于 2009-01-20T11:13:17.170 回答
4

如果您只是想测试 HTML 电子邮件是否在各种客户端中正确显示,我会使用sendmail.exe(仅限 Windows)。

您可以保存一个 .html 文件并将其作为电子邮件内容在命令行上通过管道传输到该程序中。从/到/主题/服务器等有命令行选项。

这将允许您通过编辑 .html 文件并再次运行命令行来快速发送和重新发送电子邮件。无需编程。

编辑:Linux 有一个类似的同名命令行工具。

于 2009-01-20T15:34:50.620 回答
2

红宝石变体:

require "mail"

options = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => "smtp.gmail.com",
  :user_name            => "me@gmail.com",
  :password             => "password",
  :enable_starttls_auto => true,
  :authentication       => :plain,
}

Mail.defaults do
  delivery_method :smtp, options
end

mail = Mail.new do
  to      "me@gmail.com"
  from    "Me Me me@gmail.com"
  subject "test email"

  html_part do
    content_type "text/html; charset=UTF-8"
    body File.read("index.html")
  end
end

mail.deliver

不要忘记从https://www.google.com/settings/security/lesssecureapps启用访问权限

于 2016-04-06T09:59:58.763 回答
1

如果您正在运行 .NET 并且您有一个 Gmail 帐户,这是一种简单的方法

using System.Net;
using System.Net.Mail;

var fromAddress = new MailAddress("from@gmail.com", "From Name");
var toAddress = new MailAddress("to@example.com", "To Name");
const string fromPassword = "fromPassword";
const string subject = "Subject";
const string body = "Body";

var smtp = new SmtpClient
           {
               Host = "smtp.gmail.com",
               Port = 587,
               EnableSsl = true,
               DeliveryMethod = SmtpDeliveryMethod.Network,
               UseDefaultCredentials = false,
               Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
           };
using (var message = new MailMessage(fromAddress, toAddress)
                     {
                         Subject = subject,
                         Body = body
                     })
{
    smtp.Send(message);
}

有关详细信息,请参阅通过 Gmail 在 .NET 中发送电子邮件

于 2009-01-20T12:35:10.327 回答
1

我相信您可以从 Mozilla 的 Thunderbird 电子邮件客户端发送 html 电子邮件。

http://www.mozillamessaging.com/en-US/thunderbird/

这是我用来发送测试电子邮件的内容。或者我猜你也可以使用你的电子邮件提供商。

于 2009-09-13T14:12:48.220 回答
1

我什至不会使用任何语言...

我会在MailChimp停下来并建立一个免费帐户(每月最多 500 个订阅者和 3000 次发送)...... 3000 次发送就足以测试对吗?:)

它具有您专业发送电子邮件所需的所有工具(并且可能为您的客户/朋友设置一个帐户,以便他们/他可以在他们的时事通讯中使用 MailChimp)

当您使用它时,请查看他们的资源页面以及了解我们可以使用CampaignMonitor自己的电子邮件客户端 CSS 支持指南在时事通讯中使用什么的完美工具

希望能帮助到你

于 2009-09-18T19:39:25.133 回答
1

如果您使用的是 Mac,您可以使用 Safari 和 Mail 超级快速地发送 HTML 电子邮件。我在下面的链接中写了有关详细信息的博客,但基本上您只需在 Safari 中查看您的 HTML 文件,然后选择“文件”>“此页面的邮件内容”。

http://www.ravelrumba.com/blog/send-html-email-with-safari-mail-for-fast-testing/

于 2009-11-16T04:54:01.307 回答
1

对话很晚,但这是发送 html 电子邮件的最快方法(尽管远非最佳实践):

在网络浏览器(如网页)中查看呈现的ctrl+ahtml,然后选择整个页面,然后将呈现的 html 结果ctrl+c复制并ctrl+v粘贴到电子邮件正文中。没有比这更容易的了...

请注意,如果您希望收件人看到您的图像,则需要托管它们。

于 2014-05-16T16:16:43.917 回答
0

我使用PHPMailer发送 HTML 电子邮件(通常是批量)。它对我很有用。

于 2009-01-20T12:08:47.370 回答
0

你也可以使用PowerShell

于 2009-01-20T15:37:24.267 回答
0

一个仅适用于 Windows 的免费解决方案,您通常不需要安装任何特殊的东西,那就是使用 ASP 或 WSH。我选择 JScript 而不是 VBScript:

function sendHtml(recipients, subject, html) {
    var mail = Server.CreateObject("CDO.Message");

    mail.From = "Tester <tester@example.com>";
    mail.Subject = subject;
    mail.To = recipients.join(";");
    mail.HTMLBody = html;

    // Do the following if you want to directly use a specific SMTP server
    mail.Configuration.Fields.Item(
        "http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;
    mail.Configuration.Fields.Item(
        "http://schemas.microsoft.com/cdo/configuration/smtpserver")
        = "smtp.example.com";
    mail.Configuration.Fields.Item(
        "http://schemas.microsoft.com/cdo/configuration/smtpserverport")
        = 25;
    mail.Configuration.Fields.Update();

    mail.Send();
}

注意:但是,您的 HTML 最终可能会使用这种方法稍微重新格式化。

于 2009-01-20T15:56:43.400 回答
0

测试邮件服务器工具可以帮助您-如果您只需要接收和查看您的应用程序发送的任何电子邮件。

于 2013-07-21T20:18:30.830 回答
0
function sendHtml(recipients, subject, html) {
var mail = Server.CreateObject("CDO.Message");

mail.From = "Tester <tester@example.com>";
mail.Subject = subject;
mail.To = recipients.join(";");
mail.HTMLBody = html;

// Do the following if you want to directly use a specific SMTP server
mail.Configuration.Fields.Item(
    "http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;
mail.Configuration.Fields.Item(
    "http://schemas.microsoft.com/cdo/configuration/smtpserver")
    = "smtp.example.com";
mail.Configuration.Fields.Item(
    "http://schemas.microsoft.com/cdo/configuration/smtpserverport")
    = 25;
mail.Configuration.Fields.Update();

mail.Send();
}
于 2014-12-07T12:13:17.433 回答
-1

也许您可以在 .NET 中使用 System.Net.Mail?

您可以从电子邮件模板中读取并添加到 MailMessage 正文。

发送电子邮件

            System.Net.Mail.MailMessage msg = CreateMailMessage();

            SmtpClient sc = new SmtpClient();
            sc.Host = ConfigurationManager.AppSettings["SMTPServer"];
            sc.Port = 0x19;
            sc.UseDefaultCredentials = true;

            sc.Send(msg);
于 2009-01-20T11:10:21.433 回答