The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

NeoMail Login Script!!! Anyone See A Problem With This???

Discussion in 'E-mail Discussions' started by nitromax, Apr 6, 2002.

  1. nitromax

    nitromax Well-Known Member

    Joined:
    Feb 12, 2002
    Messages:
    189
    Likes Received:
    0
    Trophy Points:
    16
    I used to be with Alabanza, and to access the webmail you would do something like this: http://domain.com/up

    I wanted to be able to setup something similar for NeoMail (and hopefully OpenWebMail when that's working), so here's what I did... Feel free to test this, and if anyone see's a problem with it please let me know. Good idea? Bad idea?

    1. I created 2 ScriptAlias's in my httpd.conf file like this:

    ScriptAlias /up /usr/local/cpanel/cgi-sys/neomail_login.cgi
    ScriptAlias /webmail /usr/local/cpanel/cgi-sys/neomail_login.cgi

    2. I Placed the neomail_login.cgi file in the cgi-sys directory shown above. Make sure the owner is root, and the group is wheel. and the file is CHMOD'd to 755. Here is the contents of that file:

    #!/usr/bin/perl

    ######################################################
    # NeoMail Login Script - Script last edited on: 04-06-02 #
    ######################################################
    use CGI;
    $cgi = new CGI();

    $command = $cgi-&param( &command& ) ;
    $pop_account = $cgi-&param ( &pop_account& ) ;
    $ipstatus = $cgi-&param( &ipstatus& );
    ($pop_username,$pop_domain)=split(/\@/,$pop_account) ;

    $http_host=$ENV{'HTTP_HOST'} ;
    $server_addr=$ENV{'SERVER_ADDR'} ;
    if ($http_host eq $server_addr) { $ipaddress=$server_addr; }

    if ( $command eq && ) {
    print &Content-type: text/html\n\n&;
    print qq| &html&&head&
    &meta http-equiv=&Content-Language& content=&en-us&&
    &meta name=&GENERATOR& content=&Microsoft FrontPage 5.0&&
    &meta name=&ProgId& content=&FrontPage.Editor.Document&&
    &meta http-equiv=&Content-Type& content=&text/html; charset=windows-1252&&
    &title&NEOMAIL  LOGIN  SCREEN&/title&
    &/head&

    &body&
    &form action=&/cgi-sys/neomail_login.cgi& method=&post&&
    &input type=&hidden& name=&command& value=&login&&
    &div align=&center&&&center&&p& &/p&&p& &/p&&p& &/p&
    &table border=&0& width=&400& cellpadding=&6& height=&147&&&tr&
    &td width=&100%& bgcolor=&#002266& height=&19&&
    &p align=&center&&&b&&font face=&Arial& color=&#FFFFFF&&
    NEOMAIL  LOGIN  SCREEN&/font&&/b&&/td&&/tr&
    &tr&&td width=&100%& bgcolor=&#EEEEEE& height=&100&&
    &div align=&center&&&center&  &br&
    &table border=&0& cellspacing=&0& width=&86%&&&tr&&td width=&100%&&
    &p align=&center&&&b&&font size=&2& face=&Arial&&
    Enter the full POP3 Email Account to check:&br&&/font&&/b& 
    &input type=&text& size=&30& name=&pop_account&&&br&
    &font size=&2& face=&Arial&&(i.e. username\@yourdomain.com)&/font&
    &p align=&center&&&font face=&Arial& size=&2&&If you are using your IP Address to
    retrieve your email, instead of your domain name, check this box:
    &input type=&checkbox& name=&ipstatus& value=&ON&&&/font&&/td&&/tr&&/table&
    &p&&input type=&submit& value=&Logon Now!& name=&submit&&
    &br&&font size=&2& face=&Arial&& &/font&&/p&
    &/center&&/div&&/td&&/tr&&/table&&/center&&/div&
    &/form&&/body&&/html&
    |;
    }

    if ( $command eq &login& ) {
    print &Content-type: text/html\n\n&;
    print qq| &html&&head&&title&&/title& |;
    if ( $ipstatus ne &ON& ) { print qq| &meta http-equiv=&refresh& content=&0 ; url=http://www.$pop_domain:2095/$pop_username+$pop_domain/neomail.pl&& |; }
    if ( $ipstatus eq &ON& ) { print qq| &meta http-equiv=&refresh& content=&0 ; url=http://$ipaddress:2095/$pop_username+$pop_domain/neomail.pl&& |; }
    print qq| &/head&&body&&/body&&/html& |;
    }


    3. Open your browser and go to http://domain.com/up, or webmail, of if you don't setup the script alias' you can access it like this: http://domain.com/cgi-sys/neomail_login.cgi. You can also access it with the IP address on the account like: http://xxx.xxx.xxx.xxx/cgi-sys/neomail.cgi

    4. Type in your full email address like: joeblow@domain.com and press the button.

    The script splits the email address and uses the first part as the username, and the domain name that follows. If the IP checkbox is checked on the login screen, then it will connect to Neomail using the IP address, but it parses the username and domain name appropriately so that it still works. Here's what the URL looks like that it creates:

    http://domain.com:2095/joeblow+domain.com/neomail.pl

    Once that URL opens it prompts you for that POP3 accounts username and password.

    Please give me feedback, whether it's good or bad.

    Nick, any chance of doing something like this for OpenWebMail when connecting via the 2095 port? That way customers can check their email with out each email user on the domain needing the master username and password to the control panel.
     
Loading...

Share This Page