Previous Thread
Next Thread
Print Thread
Rate Thread
#19280 10/22/02 12:40 AM
Joined: Sep 2002
Posts: 624
UGN GFX Whore
OP Offline
UGN GFX Whore
Joined: Sep 2002
Posts: 624
Hi guys

Listen, i need a PHP Form to e-mail script, do you guys have any script like that in PHP or other langauges maybe, but i want a good one ok.
I'm giving out a free 5 mb e-mail accout for my site http://www.snogy.com , so i wanna make an Email Registration page http://www.snogy.com/email.php probably, so i need something like the UGN Admin Application and all the submissions will be sent to my email.

I want a PHP script possiable, you guys have any suggestions or anything ?


+^Born Intelligence
#19281 10/22/02 09:24 AM
Joined: Oct 2002
Posts: 37
Junior Member
Offline
Junior Member
Joined: Oct 2002
Posts: 37
You said other languages. I do this all the time using Perl. I use CGI, strict, Apache::Constants qw(:common), and the most important one. Net::SMTP. Net::SMTP makes it really simple. A brain dead chipmunk on crack could figure out Net::SMTP in under half an hour. If you are on a *NIX system just type man Net::SMTP. It'll give you more information then you ever wanted. If you want examples of them though, I suppose I could show you some of the stuff I've done.

#19282 10/22/02 10:12 AM
Joined: Sep 2002
Posts: 624
UGN GFX Whore
OP Offline
UGN GFX Whore
Joined: Sep 2002
Posts: 624
yeah Ninja, show me some of your stuff..
i desperately need to get this working !!


+^Born Intelligence
#19283 10/22/02 12:38 PM
Joined: Oct 2002
Posts: 37
Junior Member
Offline
Junior Member
Joined: Oct 2002
Posts: 37
Ok. This is done in mod_perl. First you need to set up the appropriate mod_perl entry in your httpd.conf file. Mine looks a bit like this.

Code
<IfModule mod_perl.c>

  PerlModule Apache::DBI
  PerlSetVar mailhost 10.100.100.23

  <Perl>
    use Utils;
    use CGI;
    CGI->compile(':all');
  </Perl>

  <Location /mailer>
    SetHandler perl-script
    PerlHandler MailFormHandler
  </Location>
</IfModule>
You don't have to do that step if you don't want to. I'll explain a bit on how to avoid it shortly though. Ok lets see. The next thing you are going to need is the CGI. This is a short version of what my CGI looks like.

Code
package MailFormHandler;

$| = 1;

use strict;    #using strict.  I never code without it.
use CGI;       #I use CGI so I can automatically parse forms.
use Apache::Constants qw(:common);  #Because it's sexy.
use Net::SMTP;  #Do I really have to explain?

sub handler() {  # This handler is required for using mod_perl.

    my $obj = new CGI; # Defining my CGI.

    my $mailhost = "funeralplan.com";  #The Mail Host
    my $recipient = $obj->param("recipient"); # Who is getting the email?
    my $subject = $obj->param("subject"); #The subject of the email.  If the email doesn't have a subject entered, set the default to MailFormHandler email
    if (!$subject) {
        $subject = "MailFormHandler email";
    }
    my $sender = "[email protected]"; #Do I have to explain everything to you now?
    my $returnpage = $obj->param("returnpage"); #The return page is the page you are going to want the person to go to after they have submitted the form.  You can make them go to any page you want.  The information is kept in the form.  We will get to that.


    my $emailaddress = $obj->param("email"); # The persons email address that they entered into the form.
    my $smtp = new Net::SMTP($mailhost); #Activating the SMTP module.
    $smtp->mail($sender); #Setting the sender.
    $smtp->to($recipient); #Setting the recipient
    $smtp->data(); #Specifying that we want to start putting in some data.  Next three lines are self-explanatory.
    $smtp->datasend("To: " . $recipient . "\n");
    $smtp->datasend("From: " . $sender . "\n");
    $smtp->datasend("Subject: " . $subject . "\n\n");
#This next block is going to run through all the parameters that were in the field and put them in the email.
    my ($name, $val);
    foreach $name ($obj->param()) {
        if (($name !~ /\.x$/) and ($name !~ /\.y$/)) {
            foreach $val ($obj->param($name)) {
                $smtp->datasend($name . ": " . $obj->param($name) . "\n");
            }
        }
    }
    $smtp->dataend();
    $smtp->quit;

    print $obj->redirect($returnpage);

    return OK;

}

1;
Ok. Now for a quick look at what the form will look like.

Code
<form action="/mailer">
<input type=hidden name="recipient" value="Who Is Getting The Email">
<input type=hidden name="returnpage" value=/page/to/return/to>

<input type=hidden name="subject" value="Website Feedback">
Your Name
<input name="Name" size=40>

Your Address
<input name="address" size=40>

<input name="address2" size=40>

Your Phone Number
<input name="telephone" size=40>

Your Email
<input name="email" size=40>

Comments
<textarea rows=10 cols=40 name=Comments></textarea>

<input type=submit value="Send Comments">

</form>
If you need any more explanations on it. Feel free to let me know.

#19284 10/22/02 01:19 PM
Joined: Sep 2002
Posts: 624
UGN GFX Whore
OP Offline
UGN GFX Whore
Joined: Sep 2002
Posts: 624
Ninja thanks a lot for trying to help me out, but i just think i'm not understanding this pretty good since i don't know Perl. But you know what ? I'll email you and we'll talk through mails ok.

Thanks for your help man i appreciate it.

bp


+^Born Intelligence

Link Copied to Clipboard
Member Spotlight
Phatal
Phatal
Houston, TX
Posts: 298
Joined: April 2004
Forum Statistics
Forums41
Topics33,840
Posts68,858
Average Daily Posts1
Members2,176
Most Online3,253
Jan 13th, 2020
Latest Postings
Where and how do you torrent?
by danni75 - 03/01/24 05:58 AM
Animation,
by JohanKaariainen - 08/15/19 01:18 AM
Blackbeard.....
by Gremelin - 10/03/18 07:02 PM
my old account still exists!
by Crime - 08/10/18 02:47 PM
Okay WTF?
by HenryMiring - 09/27/17 01:45 AM
The History Thread...
by Gremelin - 08/11/17 12:11 PM
My friend NEEDS your HELP!
by Lena01 - 07/21/17 12:06 AM
I'm having fun with this guy.
by gabithompson730 - 07/20/17 01:50 AM
I want to upgrade my phone
by gabithompson730 - 07/20/17 01:49 AM
Doom 3
by Cyrez - 09/11/14 08:58 PM
Amazon Gift Card Generator/KeyGen?te
by Gecko666 - 08/22/14 09:21 AM
AIM scene 99-03
by lavos - 09/02/13 08:06 AM
Planetside 2
by Crime - 03/04/13 07:10 AM
Beta Testers Wanted
by Crime - 03/04/13 06:55 AM
Hello Everyone
by Gremelin - 02/12/12 06:01 PM
Tracfone ESN Generator
by Zanvin Green - 01/18/12 01:31 PM
Python 3 issue
by Testing - 12/17/11 09:28 PM
tracfone airtime
by Drache86 - 07/30/11 03:37 AM
Backdoors and the Infinite
by ZeroCoolStar - 07/10/11 03:52 AM
HackThisZIne #12 Releaseed!
by Pipat2 - 04/28/11 09:20 PM
gang wars? l33t-wars?
by Gremelin - 04/28/11 05:56 AM
Consolidate Forums
by diggin2deep - 04/21/11 10:02 AM
LAN Hacking Noob
by Gremelin - 03/12/11 12:42 AM
Top Posters
UGN Security 41,392
Gremelin 7,203
§intå× 3,255
SilentRage 1,273
Ice 1,146
pergesu 1,136
Infinite 1,041
jonconley 955
Girlie 908
unreal 860
Top Likes Received
Ghost 2
Cyrez 1
Girlie 1
unreal 1
Crime 1
Powered by UBB.threads™ PHP Forum Software 7.7.5