Well, provided you have installed perl and some other perl-modules you can use perl-mail and mysql.
First, ensure you have installed this from optware repo:
Code:
ipkg list_installed |grep perl
should give you the following output:
Code:
perl - 5.8.8-23 - Practical Extraction and Report Language.
perl-carp-clan - 5.3-1 - This module reports errors from the perspective of the caller of a clan of modules, similar to Carp.pm itself.
perl-date-calc - 5.4-2 - Gregorian calendar date calculations.
perl-date-manip - 5.48-1 - date manipulation routines
perl-dbd-mysql - 4.006-1 - DBD-mysql - The Perl Database Driver for MySQL.
perl-dbi - 1.607-1 - DBI - The Perl Database Interface by Tim Bunce.
Then you are fine, now lets adjust your lighttpd.conf
Activate the mod cgi:
and after section index-file.names insert this:
Code:
#tell lighty howto handle cgi
$HTTP["url"] =~ "/cgi-bin/" {
cgi.assign = ( ".pl" => "/opt/bin/perl",
".cgi" => "/opt/bin/bash",
".sh" => "/bin/sh" )
}
In case you do not need to assign bash and shell, just set extension .cgi to perl. Then your cgi.assign should look like this:
Code:
#tell lighty howto handle cgi
$HTTP["url"] =~ "/cgi-bin/" {
cgi.assign = ( ".pl" => "/opt/bin/perl",
".cgi" => "/opt/bin/perl" )
}
With the first cgi.assign example you can install this webinterface for your optware installations. Please consider anytime the security risks. If you do not know what you are doing including related consequences, please install just the second example of cgi.assign.
Well now the perl-testpage, store it to folder cgi-bin/mailnow.pl of your webservers document root.
Just set the vars to and from to your needs.
Code:
#!/opt/bin/perl
print "Content-type: text/html\n\n";
$title='Perl Mail Test for Asusrouters';
$to='recipient@domain.net';
$from= 'yourasusaccount@yourdomain.com';
$subject='Perl Mail Test';
open(MAIL, "|/opt/bin/esmtp -t");
## Create Header, Message and send everything, consider after subject \n\n - it's an emty line
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
## Mail Message
print MAIL "This is your first Perl Message from your Asus or any other machine\n";
print MAIL "When you are able to read this message, your Perl including cgi-bin works!\n";
print MAIL "This example is taken from: http://www.cyberciti.biz/faq/sending-mail-with-perl-mail-script/\n";
print MAIL "and adapted by user newbiefan for asusrouter.\n";
close(MAIL);
print "<html><head><title>$title</title></head>\n<body>\n\n";
## HTML content sent, let us know we have sent an email
print "
<h1>$title</h1>
An Email has been sent from $from to $to
</body></html>";
Consider to set the rights to 755.
Have fun