有什么快速、简单的方法可以向我自己发送 HTML 电子邮件来测试它们?
题
我的任务是针对不同的电子邮件/网络邮件客户端优化 HTML 电子邮件。我曾经通过在 Outlook Express 中执行一个技巧来测试 HTML 文件,使其发送原始 HTML,但微软现在似乎已经停止提供 Outlook Express(我认为“Live Mail”应该取代它)。
所以我的问题是,有没有一种简单、快捷的方法来发送 HTML 电子邮件?甚至可能是一个可以完成这项工作的免费软件程序?
解决方案
一个测试邮件服务器的工具可以与帮助 - 如果你只是需要接收和查看由应用程序发送的所有电子邮件。
其他提示
提出邮件是最好的选择,这些天。检查出回答由看跌期权的创建者的一个类似的问题邮件。
我会使用Python,这里的底部是一个例子如何创建一个文本默认情况下,HTML电子邮件:的 http://docs.python.org/library/email-examples.html 可以参数化此,封装在功能,读取文件等内容(确保,你在本地主机设置“S = smtplib.SMTP(‘localhost’的)”到您的SMTP服务器)
如果你只是测试是否HTML电子邮件中正确显示不同的客户,我会用 sendmail的。 EXE (仅视窗)。
可以保存一个HTML文件和管其插入命令行作为电子邮件内容该程序。存在用于命令行选项从/到/受试者/服务器等
这将使您能够快速发送和只需要编辑.html文件并再次运行命令行重新发送电子邮件。无需编程。
编辑:没有针对Linux具有相同名称类似的命令行工具
如果您使用的是Mac,你可以快速发送使用Safari浏览器和邮件的HTML电子邮件超。我的博客上讲述在下面的链接的详细信息,但基本上你只是浏览Safari和选择文件HTML文件>的邮件发送此页内容。
HTTP:// www.ravelrumba.com/blog/send-html-email-with-safari-mail-for-fast-testing/
我相信你可以从Mozilla的Thunderbird电子邮件客户端发送HTML格式的电子邮件。
http://www.mozillamessaging.com/en-US/thunderbird/一>
这是我用来发送电子邮件的测试。或者,我想你可以用你的电子邮件提供商了。
我会 不是 甚至去 任何语言 ...
我会停在 邮件黑猩猩 并设立一个 免费账号 (每月最多 500 名订阅者和 3000 次发送)...3000 次发送足够测试了吧?:)
它拥有专业发送电子邮件所需的所有工具(也许还可以为您的客户/朋友设置一个帐户,以便他们/他可以在新闻通讯中使用 MailChimp)
当你在做的时候,看看他们的 资源 页面也是了解我们可以在新闻通讯中使用什么的完美工具 活动监控器 自己的 电子邮件客户端中的 CSS 支持指南
希望能帮助到你
如果您运行的.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电子邮件更多的细节
红宝石变体:
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
我发送使用 PHPMailer的 HTML电子邮件(经常散装)。它为我伟大的工作。
还可以使用 PowerShell的
一个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最终也许能得到这种方法略有重新格式化
非常晚的谈话,但这里是最快的方法(虽然远非最佳实践)发送一个HTML邮件:
查看您的渲染的HTML的网页浏览器(如网页),然后ctrl+a
选择整个页面,然后ctrl+c
复制和粘贴ctrl+v
呈现的HTML结果到您的电子邮件正文中。没有比这更容易的任何...
不过请注意,你的图像需要被托管,如果你想收件人看到他们。
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();
}
也许你可以在.NET中使用System.Net.Mail?
您可以从电子邮件模板读取和assing到身体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);