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肿。 不过,请您的联系人帮忙-使用此脚本!
php发送电子邮件