php发送电子邮件_PHP电子邮件编码器–防止垃圾邮件机器人收集电子邮件地址

php发送电子邮件

Police have criminals. PETA has Michael Vick. Bud Selig has Barry Bonds. Programmers have spammers.

警察有罪犯。 PETA有Michael Vick。 巴德·塞利格(Bud Selig)拥有巴里·邦兹(Barry Bonds)。 程序员有垃圾邮件制造者。

Email spam is probably the most annoying part of my job. Whenever I'm placing email addresses on a page or coding another web form, I have to expend extra time preventing spammers from exploiting the information I put on the page. Spammers are my adversary and the war seemingly never ends. I do have a quick PHP script that I use when putting raw email addresses on a page:

电子邮件垃圾邮件可能是我工作中最烦人的部分。 每当我在页面上放置电子邮件地址或编写其他Web表单代码时,我都必须花费额外的时间来防止垃圾邮件发送者利用我在页面上放置的信息。 垃圾邮件发送者是我的对手,战争似乎永无止境。 在页面上放置原始电子邮件地址时,确实有一个快速PHP脚本:

功能 (The Function)

function encode_email($e) {
	for ($i = 0; $i < strlen($e); $i++) { $output .= '&#'.ord($e[$i]).';'; }
	return $output;
}

用法 (Usage)

echo(encode_email('user@davidwalsh.name'));

The above function takes a string input (the email address), loops through each character replacing the letter with the character's ASCII value, and returns the encoded email address. That's all you need to do!

上面的函数接受一个字符串输入(电子邮件地址),循环遍历每个字符,用字母的ASCII值替换字母,然后返回编码后的电子邮件地址。 这就是您需要做的!

I realize that this is not a bulletproof solution. A good (and dedicated) spammer would take a page's code, turn every character of the code into ASCII, and proceed to parse the newly ASCII'd code. If you have a page with hundreds of addresses, the page download will be bloated. Do your contacts a favor though -- use this script!

我意识到这不是防弹解决方案。 一个好的(专用的)垃圾邮件发送者会采用页面的代码,将代码的每个字符转换为ASCII,然后继续解析新的ASCII码。 如果您的页面上有数百个地址,则页面下载将变得ated肿。 不过,请您的联系人帮忙-使用此脚本!

翻译自: https://davidwalsh.name/php-email-encode-prevent-spam

php发送电子邮件

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值