Mojolicious::Plugin::AntiSpamMailTo - Mojolicious plugin for obfuscating email addresses
#!/usr/bin/env perl use Mojolicious::Lite; plugin 'AntiSpamMailTo'; app->mailto('zoffix@cpan.com'); # save the address get '/' => 'index'; app->start; __DATA__ @@ index.html.ep <p><a href="<%== mailto_href %>"> Send me an email at <%== mailto %> </a></p>
Every call to mailto_href() or mailto() updates the globally stored email address. But you can use a different address each time:
mailto_href()
mailto()
#!/usr/bin/env perl use Mojolicious::Lite; plugin 'AntiSpamMailTo'; get '/' => 'index'; app->start; __DATA__ @@ index.html.ep <p><a href="<%== mailto_href 'foo@example.com' %>"> Send me an email at <%== mailto 'bar@example.com' %> </a></p>
The output in the browser would be this, with each character in the email address HTML encoded:
<p><a href="mailto:zoffix@cpan.com"> Send me an email at zoffix@cpan.com </a></p>
Mojolicious::Plugin::AntiSpamMailTo is a Mojolicious plugin for outputting email addresses as encoded HTML entities, which (kinda seems to) confuses a bunch of noobish spam bots, lowering the amount of crap you get sent to the address.
Mojolicious::Plugin::AntiSpamMailTo inherits all methods from Mojolicious::Plugin and implements the following new ones.
$plugin->register(Mojolicious->new);
Register plugin in Mojolicious application.
mailto
Send me an email at <%== mailto 'zoffix@cpan.com' %>
Takes one optional argument, an email address, and returns an encoded version of it. The email address gets stored, so any future calls without any arguments will use the address from the previous call to mailto or mailto_href.
mailto_href
<a href="<%== mailto_href 'zoffix@cpan.com' %>">Send me an email</a>
This is what's you use in href="" attributes. Takes one optional argument, an email address, prepends string mailto: to it, and returns an encoded version of it. The email address gets stored so any future calls without any arguments will use the address from the previous call to mailto or mailto_href.
href=""
mailto:
Fork this module on GitHub: https://github.com/zoffixznet/Mojolicious-Plugin-AntiSpamMailTo
To report bugs or request features, please use https://github.com/zoffixznet/Mojolicious-Plugin-AntiSpamMailTo/issues
If you can't access GitHub, you can email your request to bug-mojolicious-plugin-antispammailto at rt.cpan.org
bug-mojolicious-plugin-antispammailto at rt.cpan.org
Zoffix Znet zoffix at cpan.org, (http://zoffix.com/)
zoffix at cpan.org
You can use and distribute this module under the same terms as Perl itself. See the LICENSE file included in this distribution for complete details.
LICENSE
To install Mojolicious::Plugin::AntiSpamMailTo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::AntiSpamMailTo
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::AntiSpamMailTo
For more information on module installation, please visit the detailed CPAN module installation guide.