Results 1 to 10 of 10

Thread: [Howto] Esmtp Email, PHP, Reminder, send_logfile

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2007
    Location
    The Netherlands - Eindhoven
    Posts
    1,767
    Looks good newbiefan
    The initial setup of esmpt I did have the error "Error parsing headers" tho I'm not sure why.
    The PHP setup works great tho

    Good job on the php scripts for a non php-coder
    Last edited by wpte; 04-06-2011 at 19:59.

  2. #2
    Join Date
    Jul 2007
    Location
    Austria
    Posts
    1,336
    Quote Originally Posted by wpte View Post
    Looks good newbiefan
    The initial setup of esmpt I did have the error "Error parsing headers" tho I'm not sure why.
    The PHP setup works great tho

    Good job on the php scripts for a non php-coder
    Well, I think "Error parsing headers" was my mistake - just enter an emty line between header and body (text message).
    Thanks for trying it and pointing me in the right direction with the error.
    I changed already the file email of the initial setup.


    newbiefan
    Alle HowTo's, all howto's

    RT-N16 1.9.2.7-rtn-r3121, Samba, VSFTP, Lightthpd, PHP, Perl, MySQL, Serendipity, Aria2web, HDD 640GB
    RT-N66U, 16GB MicroSD/ 2 Partitions, 2,5" HDD 1TB, running with Merlin's FW and Entware, 16 Mbit A1,
    Netgear DGND 3700V2, QNAP TS119PII 4 TB, QNAP TS209 2 TB Raid1, Backup Synology DS107+ 1 TB, HP CP1515n

  3. #3
    Join Date
    Jul 2007
    Location
    Austria
    Posts
    1,336

    howto use perl-mail with lighttpd

    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:
    Code:
                                    "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
    Attached Files Attached Files
    Last edited by newbiefan; 15-01-2012 at 08:06.
    Alle HowTo's, all howto's

    RT-N16 1.9.2.7-rtn-r3121, Samba, VSFTP, Lightthpd, PHP, Perl, MySQL, Serendipity, Aria2web, HDD 640GB
    RT-N66U, 16GB MicroSD/ 2 Partitions, 2,5" HDD 1TB, running with Merlin's FW and Entware, 16 Mbit A1,
    Netgear DGND 3700V2, QNAP TS119PII 4 TB, QNAP TS209 2 TB Raid1, Backup Synology DS107+ 1 TB, HP CP1515n

Similar Threads

  1. Îòïðàâêà IP àäðåñà WAN èíòåðôåéñà ïî SMS è eMail
    By ncat in forum Russian Discussion - РУССКИЙ (RU)
    Replies: 30
    Last Post: 20-03-2013, 16:14
  2. Powiadomienia na email rtorrent+nail
    By jabol.91 in forum Polish Discussion - Polski (PL)
    Replies: 2
    Last Post: 15-11-2011, 12:48
  3. Email from router
    By Googol in forum WL-500g Q&A
    Replies: 33
    Last Post: 26-08-2010, 07:32
  4. [How-To] Send email with php function
    By cichy in forum WL-500gP Tutorials
    Replies: 3
    Last Post: 11-09-2009, 16:01
  5. esmtp remove Message-Id in the body of the mail
    By boobax in forum WL-500g Q&A
    Replies: 3
    Last Post: 11-02-2008, 07:49

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •