rami.info



URLEncode And URLDecode For Perl

Posted in Code, Perl by Rami on the November 19th, 2005

PHP has builtin functions for urlencode and urldecode functions but for perl I’ve found the following from HERE that does the same thing:

sub URLDecode {
my $theURL = $_[0];
$theURL =~ tr/+/ /;
$theURL =~ s/%([a-fA-F0-9]{2,2})/chr(hex($1))/eg;
$theURL =~ s/<!–(.|\n)*–>//g;
return $theURL;
}

sub URLEncode {
my $theURL = $_[0];
$theURL =~ s/([\W])/”%” . uc(sprintf(”%2.2x”,ord($1)))/eg;
return $theURL;
}

Testing SSL Services

Posted in TechNotes by Rami on the November 9th, 2005

Testing SSL services by connecting to it is possible using the following command:

openssl s_client -connect host:port -state

Using Sendmail’s mailertable

Posted in TechNotes by Rami on the November 8th, 2005

Edit sendmail.mc and add the following:

FEATURE(`mailertable')dnl

Run:

m4 sendmail.mc > sendmail.cf

Create /etc/mail/mailertable and add the incoming mail to route as in:

example.com smtp:[192.168.0.1]

Run:

makemap hash /etc/mail/mailertable < /etc/mail/mailertable

Restart sendmail.

Setting Up Sendmail To Act As An MX Backup Server

Posted in TechNotes by Rami on the November 8th, 2005

Edit or create /etc/mail/relay-domains and add the domains you want to have MX backup for one on each line.

Byyee SpamInferno and Hi Brightmail

Posted in Software by Rami on the November 8th, 2005

I have been running on SpamInferno for the past two years for blocking the 200-300 spam messages I receive a day. I made SpamInferno when I liked the idea of not having a single spam in my mailbox. Lately though I don’t mind a couple as long as people don’t need to authenticate themselves to send me emails nor I need to accept emails manually from companies. Today I finally stopped using SpamInferno and switched to Symantec Brightmail which does exactly what I want. I only have about 5 active users on my machine so it won’t be that expensive for me to get the $28/mailbox/year license but the only bad thing is that it has a minimum of 10 licenses to get. On the other hand, a really good thing about it now is that my MX points to one of my machines at home that does the filtering and inturn saves me bandwidth on my server in the US. Once the 30 day trial is over I’m probably getting the 10 licenses to free myself from SPAM!