Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Eliminating useless server information

by sulfericacid (Deacon)
on Oct 14, 2002 at 04:39 UTC ( #204975=perlquestion: print w/ replies, xml ) Need Help??
sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:

I have a contact form when used on my server it shows the IP and everything from it. Does anyone have a snipplet or know of a VERY commonly used perl module which can be used to either predefine an IP or just not use one? Thanks in advance. sulfericacid

Comment on Eliminating useless server information
Re: Eliminating useless server information
by sulfericacid (Deacon) on Oct 14, 2002 at 04:52 UTC

    Ok I don't think I did a good job explaining what it is I am looking for, so here it goes.

    I have a contact form on my server and when it's received your email client will show you the IP address of the server. I want to be able to send emails from my form without it presenting my IP address, or have it setup where I can predefine an IP ie. $ip = '66.54.159.11'; .

    Thanks

    sulfericacid

      Is the perl sending the email?? Or are you using the POST enctype mailto method from an html document? Big difference on options here. If it's a perl script which answers the form submit button and sends an email; just edit your mail message to include a from line from:noreply@mail.com in the message head. If you want to remove the server name in the message head itself (Viewable in a mail client by clicking view source you'll have to change that in your server dns settings).
        I am using an html form to use the script below to send the actual message. I don't want it to say ANYTHING period in the from line, just a null space.
        #!/usr/local/bin/perl ###### SpyderForm v1.0 ###### ## Created by Aaron Anderson ## ## sulfericacid@qwest.net ## ## website: http://secretrealmofme.hypermart.net/webstuff ;## ## Please read the readme file prior to installation. ## ## If you cannot find readme, dl a copy from my site! ## use strict; # Let's have some fun my'ing things, shall me? my %form; my $sendmail; my $webmaster; my $yourname; my $thanks; use CGI; my $query = CGI->new; print $query->header; %form = %{$query->Vars}; ##################### BEGIN EDITING THIS SECTION ##################### +######## $sendmail = "/var/qmail/bin/qmail-inject"; $webmaster = 'sulfericacid@qwest.net'; ( $thanks = <<'END_OF_THANKS' ) =~ s/^\s+//gm ; Thank you for visiting my website! Things are always changing so I hope you pop back again! If you asked any questions, please allow upto 24 hours for a response. END_OF_THANKS $yourname = 'Aaron'; # $signame = 'Aaron Anderson\n'; # $sigurl = 'www.yourdowmain.com\n";; #################### STOP EDITING FOR NOW ############################ +######### ### Make sure things are being completed, die slackers! if ($webmaster eq "") { print "Webmaster, please include your email address!\n"; } if ($form{'usermail'} eq "") { print "Ok, buddy, how do you expect me to email you back if you FORGET + to leave yoru email address?!?\n"; } if ($form{'username'} eq "") { print "Please click back and type in your name so I can spy on you!\n" +; } if ($form{'message'} eq "") { print "Only a severe slacker would try to submit a form without leavin +g a message!\n"; } # Mail to Webmaster open (MAIL, '|-', "$sendmail -t") or die $!; print MAIL "To: $webmaster\n"; print MAIL "From: $form{'usermail'}\n"; print MAIL "Subject: Insert subject here!\n\n"; print MAIL "Name- $form{'username'}\n"; print MAIL "Url- $form{'userweb'}\n"; print MAIL "Message- $form{'message'}\n"; print MAIL "Ip- $ENV{'REMOTE_ADDR'}\n"; close (MAIL); # Mail to User open (MAIL, '|-', "$sendmail -t") or die $!; print MAIL "To: $form{'usermail'}\n"; print MAIL "From: $form{'weburl'}\n"; print MAIL "Subject: Thank you for signing my form!\n\n"; print MAIL "$thanks\n"; print MAIL "You said:\n"; print MAIL "$form{'message'}\n"; close (MAIL); # Let's give them something to look at, might as well, they were nice +enough to fill out the form! ####################### BEGIN EDITING HERE 2 ######################### +############# print <<end_of_results; <html> <head> <title>Results Page</title> </head> <table width="75%" border="0"> <tr> <td colspan="2"> <p>Thank you for filling out the form. If you are awaiting assis +tance and you asked a question, please allow upto 24 hours for my to get + back to you.</p> <p>- $yourname</p> </td> </tr> <tr> <td colspan="2"><font color="#9933CC">Here is a copy of what you s +ent...</font></td> </tr> <tr> <td width="9%"><font color="#666666">name:</font></td> <td width="91%"><font color="#999999">$form{'username'}</font></td +> </tr> <tr> <td width="9%"><font color="#666666">email:</font></td> <td width="91%"><font color="#999999">$form{'usermail'}</font></td +> </tr> <tr> <td width="9%"><font color="#666666">url:</font></td> <td width="91%"><font color="#999999"><a href="$form{'weburl'}">$f +orm{'weburl'}</a></font></td> </tr> <tr> <td width="9%"><font color="#666666">message:</font></td> <td width="91%"><font color="#999999">$form{'message'}</font></td> </tr> <tr> <td width="9%"><font color="#666666">Rec. IP:</font></td> <td width="91%"><font color="#999999">$ENV{'REMOTE_ADDR'}</font></ +td> </tr> <tr> <td width="9%"> </td> <td width="91%"> </td> </tr> </table> end_of_results
      The IP address is most likely included to prevent abuse, by logging a fairly reliable indication of the source of the connection (or at least a cooperating middle agent). The most common reason to want something else there is if someone is going to engage in a fraudulant action (like sending spam using a third-party relay).

      Are you saying you want to be abused, or that you want to abuse someone else? It's still not clear from the message. If you merely don't want to show it, then simply remove it from the CGI script. If you want to alter it, then come at the machine from a different address. There's really no ordinary way to just "set" it.

      -- Randal L. Schwartz, Perl hacker

        I know a mail client needs an sender IP for it to send on most servers, what i would like to do is set $userip = '#' or something.
        The script I made and am currently updating is found above, as you can see it's not coded in the way you like, you can whine about it like you did last time if you want. I want to make it anonymous not to be abused or to abuse, but for the sake of doing it. There are anonymous email scripts in perl out there but they aren't free so I can't see how they did it.
        sulferciacid
Re: Eliminating useless server information
by fsn (Friar) on Oct 14, 2002 at 16:00 UTC
    Fellow monk, I'm afraid you simply are not clear enough. Where does the IP address show? In the email, at the client side? In a Recieved-line? In the browser when the mail is sent?

    If the IPaddress is shown in the email at the From: or To: line, it's added by your local mailserver, because one of the email adresses were not complete, ie. <user> instead of <user@domain.cc>, the @ is vital here. Your local mailserver then adds it's official name. However, it may be not know it's officiall name, and then adds it's IPaddress as domain. You can send emails directly to IPaddresses, so they are valid on the right side of an @.

    If your IPaddress show up on a Recieved: -line, I'm sorry, but that's how it's supposed to be. It's added by the next mailserver, indicating where it got the mail from, you can't change it.

    If the browser shows the IP address when you have sent the mail, it's because you print it somewhere in your script.

    Try specifying more accurately where it's showing the IPaddress in question and we'll see if we can help you.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://204975]
Approved by mce
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2014-07-26 18:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (178 votes), past polls