ColdFusion - 发送一封漂亮的电子邮件,薄荷风格

发布于 2024-08-25 05:24:45 字数 128 浏览 8 评论 0 原文

我多年来一直使用 ColdFusion 发送文本电子邮件。我现在有兴趣学习如何发送您在 Mint 等公司看到的漂亮电子邮件。

有人知道一个好的 ColdFusion 教程来教我如何完成这项工作而不被错误或垃圾邮件过滤器击中吗?

I've used ColdFusion for sending text emails for years. I'm now interested in learning how to send those pretty emails you see from companies like Mint.

Anyone know of a good ColdFusion tutorial to teach me how to make this work and not get hit by bugs or spam filters?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

诗酒趁年少 2024-09-01 05:24:45

正如 Ray 所说,ColdFusion 支持 HTML 电子邮件,这就是使电子邮件变得“漂亮”的方法。一个快速的脏样本看起来像这样:

<cfmail from="[email protected]" to="[email protected]" subject="Check this out!" type="HTML">
    <HTML>
       <head><title>My Email</title>

       </head>
       <body>
           <!--- Style Tag in the Body, not Head, for Email --->
           <style type="text/css">
               body { font-size: 14px; }
           </style>
           This is the text of my email.
       </body>
    </HTML>
</cfmail>

就是这样,您刚刚发送了一封电子邮件。请注意,没有什么可以阻止您粘贴任何您喜欢的旧电子邮件地址?这引出了我的下一点,其中您想知道如何避免被垃圾邮件过滤器击中:

简短的答案是:您不能。

哦,当然,你可以做一些聪明的事情,比如在你的电子邮件中不包含“VIAGRA”这个词(除非你想发送阴茎增大电子邮件并且想知道如何通过垃圾邮件过滤器,在这种情况下我不愿意来帮助),但我们假设您只是想避免明显的陷阱。

我可以想到两件事可能会有所帮助:

  • 从注册到发件人电子邮件地址的域发送电子邮件。我没有制定规则,但这可能会很痛苦。即,如果您尝试发送 myorg.com 的代理电子邮件,并且您的服务器不托管 myorg.com,则某些垃圾邮件过滤器将阻止它。通常所做的是将一些品牌应用到发件人电子邮件中,如下所示:

    [电子邮件受保护]>"回复="[电子邮件受保护]" to="[电子邮件受保护]" subject="Test" type="HTML">

在这种情况下,电子邮件是从您位于Registeredsite.com 的服务器发送的,回复是代理电子邮件地址。垃圾邮件过滤器可能会同意这一点,因为 *@registeredsite.com 的发件人电子邮件地址会解析到您的服务器。尝试在发件人中使用 [email protected] 发送,然后您'肯定会遇到一些阻碍你的地方。

  • 使用物理服务器,而不是云站点。我现在遇到了这个问题,但是如果您不使用位于专用 IP 的物理服务器来发送您的电子邮件,并且如果该服务器不是电子邮件的发起者,则某些地方将会发生阻止它。这意味着没有 EC2 或 Rackspace 云站点 - 抱歉,一些系统管理员倾向于对源自这些提供商之一的任何内容进行封杀,因为使用 EC2 或 Rackspace 很容易搅动您自己的小型垃圾邮件工厂。成本非常低。

然而,即使您采取了这些预防措施,您也会遇到这样的情况:有人获得您的域名并将其拖入泥沼。他们会以您的名义(或者更确切地说,以您的域名)向互联网发送数千封电子邮件,并且由于电子邮件的不安全性,您的域名在出现一千次 [email protected] 点击系统管理员的收件箱。你也无能为力。

或者您可以决定运行云应用程序并使用远程邮件服务器。但一些爱开玩笑的人一看到发起者是 EC2,就会说:“不,抱歉。被拒绝了。”他们不关心您组织的合法性,只关心电子邮件的来源。

电子邮件是一种过时的技术,在我们真正能够想到更好的协议之前,它就已经被匆忙地广泛使用。作为一个协议,它很糟糕……但出于向后兼容性的原因,我们仍然坚持使用它。您不可能避免垃圾邮件过滤器。 互联网上 95% 的电子邮件都是垃圾邮件,甚至从来没有到达预期的收件人。只需暂时吸收该统计数据的巨大性,然后将您的想法拉回到现实即可。目前使用的许多垃圾邮件防护技术都具有不必要的攻击性,并且会产生大量“误报”。比如说,您可以争取发送 80% 的电子邮件,但真正的问题是:电子邮件一旦发出,就完全脱离了您的控制。你只能承担这么多的责任。

As Ray said, ColdFusion supports HTML email, which is how you make an email "pretty". A quick down and dirty sample looks like this:

<cfmail from="[email protected]" to="[email protected]" subject="Check this out!" type="HTML">
    <HTML>
       <head><title>My Email</title>

       </head>
       <body>
           <!--- Style Tag in the Body, not Head, for Email --->
           <style type="text/css">
               body { font-size: 14px; }
           </style>
           This is the text of my email.
       </body>
    </HTML>
</cfmail>

That's it, you've just sent an email. Notice how there is nothing preventing you from sticking in any old from email address you like? That leads me to my next point, in which you're wondering how to avoid getting hit by Spam filters:

The short answer is: You can't.

Oh sure, you can do intelligent things, like not including the word "VIAGRA" in your email (unless you're trying to send out penile enlargement emails and want to know how to get past spam filters, in which case I'm disinclined to help), but let's assume you just want to avoid obvious pitfalls.

I can think of two things that might help:

  • Send out email from a domain registered to the from email address. I didn't make the rules, but this one can be a pain. Ie., If you try to send out proxy emails for myorg.com, and your server does not host myorg.com, some spam filters are going to block it. What is usually done is to apply some branding to the from email, like this:

    <cfmail from="MyOrg.Com <[email protected]>" replyto="[email protected]" to="[email protected]" subject="Test" type="HTML">
    </cfmail>

In this case the email is sent from your server at registeredsite.com, with a replyto being the proxy email address. Spam filters will probably be okay with this, since the from email address of *@registeredsite.com resolves to your server. Try to send out with [email protected] in the from, and you'll definitely run into some places that will block you.

  • Use a physical server, not a cloud site. I'm running into this very issue right now, but if you don't use a physical server that is located at a dedicated IP to send out your email, and if this server is not the originator of the email, some places are going to block it. This means no EC2 or Rackspace cloud site--sorry, some sysadmins are inclined to put down the banhammer on anything that originates from one of these providers, seeing as it is so easy to churn up your own little spam factory using EC2 or Rackspace for very little cost.

Even if you take these precautions, however, you'll run into a situation where someone gets a hold of your domain name and drags it through the mud. They'll send out thousands of emails to the internet in your name--or rather, in your domain's name--and because of the insecurity of email, your domain will get added to someone's blacklist after a thousand occurrences of [email protected] hit the sysadmin's inbox. There's nothing you can do about it, either.

Or you can decide to run a cloud app and use a remote mail server. But some jokers will get one look at the originator being EC2 and will say, "Nope, sorry. Denied." They don't care about the legitimacy of your organization, only the origin of the email.

Email is an antiquated technology that has been rushed into mass usage before we really were able to think of a better protocol. As a protocol, it's terrible....and yet we're stuck with it, for backwards compatibility reasons. You cannot possibly avoid the spam filter. 95% of the email on the internet is junk mail, and never even reaches the intended recipient. Just absorb the enormity of that statistic for a moment, and pull your ideas back to reality. Many of the spam-prevention techniques being used today are unnecessarily aggressive, and create a great many 'false positives'. You can shoot for, say 80% of your email being sent, but what it really comes down to is this: As soon as the email has been fired off, it's completely out of your control. You can only take responsibility for so much.

〆凄凉。 2024-09-01 05:24:45

基于 HTML 的“漂亮”是什么意思? CF 支持 html 电子邮件。只需使用 type="html" 即可。您还可以使用 cfmailpart 发送相同内容的文本和 html 版本。

What do you mean by "pretty" - HTML based? CF supports html email. Just use type="html". You can also use cfmailpart to send both text and html versions of the same content.

殤城〤 2024-09-01 05:24:45

这是一篇关于使用 CSS 制作 HTML 电子邮件的好文章:

http://articles.sitepoint .com/article/code-html-email-newsletters

Ray 对于 CF 部分的回答在金钱上是正确的,但是这项工作的大部分工作都是关于 HTML、CSS 和测试测试。

Here's a good article on making HTML email using CSS:

http://articles.sitepoint.com/article/code-html-email-newsletters

Ray's answer is right on the money about the CF part, but most of making this work is about HTML, CSS and testing testing testing.

朕就是辣么酷 2024-09-01 05:24:45

我想补充一点,您可以通过访问一个名为 litmusapp 的网站来检查邮件是否会正确显示以及是否会被垃圾邮件过滤器击中。您可以将测试时事通讯发送到他们的电子邮件地址之一,然后他们会给您屏幕截图,显示每份时事通讯在每种类型的电子邮件客户端中的外观。它还会根据一些流行的垃圾邮件拦截器检查时事通讯,并为您提供有关更改内容的建议。

And I would add to this all that you can check whether a mail will be displayed correctly and whether it will get hit by a spamfilter or not by going to a website that is called litmusapp. You can send your test newsletter to one of their emailaddresses and then they will give you screenshots of how each newsletter will look like in each type of emailclient. Also it checks the newsletter against a few popular spamblockers and gives you advice on what to change.

长亭外,古道边 2024-09-01 05:24:45

我首先会找到您喜欢的 HTML 模板电子邮件。然后将其放入类型设置为 html 的标签中,如上所述。您可能需要考虑使用多部分电子邮件来处理纯文本(和黑莓)用户。

I would start by finding an HTML template email that you like. Then you put it in the tags with the type set to html as mentioned above. You might want to consider doing the multipart email to handle plaintext (and blackberry) users.

云之铃。 2024-09-01 05:24:45

我订阅了 Campaign Monitor 时事通讯和他们还在这里列出了非常有用的文章:http://www.campaignmonitor.com/resources/

I subscribe to the Campaign Monitor Newsletter & they also have a list of very useful articles here: http://www.campaignmonitor.com/resources/

夜深人未静 2024-09-01 05:24:45

可能想查看这本来自 MailChimp 的电子书。电子邮件应用程序以一些不寻常的方式呈现 HTML,因此请准备好使用表格进行布局。

Might want to check out this ebook from MailChimp. Email apps render HTML in some unusual ways, so be prepared to use tables for layout.

一梦等七年七年为一梦 2024-09-01 05:24:45

请记住,当您在编写cfmail时尝试更改字体或背景颜色时,在添加#F0000之前,需要在其前面添加额外的# ,如##F0000。否则会导致错误。

Remember when you try to change the color of the font or background when you writing a cfmail, before you add #F0000, you need to ad extra # at the front of it, like ##F0000. Otherwise, it will cause an error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文