develooper Front page | perl.beginners | Postings from March 2002

Re: send email and upload file

Thread Previous | Thread Next
From:
Jonathan E. Paton
Date:
March 4, 2002 11:50
Subject:
Re: send email and upload file
Message ID:
20020304195007.43999.qmail@web14602.mail.yahoo.com
> My apologies to everyone but this list does say
'beginners'.

Indeed it does, though some of us have lost our beginner
status :)

> My problem...I am trying to modify a script that a
co-worker
> wrote for us. He no longer works here.  

Typical


The snippets of the script below

> #!/usr/bin/perl

Eak... no warnings, make sure you add -w to that.

> BEGIN {    
> $email_addresses = "blah\@blah.com,
blahblah\blah.com,etc";

If this whole script is within the BEGIN block we could be
in
trouble... shows someone who didn't understand what it is
for.

You should be starting to get suspious, this BEGIN should
be
removed immediately.

> &Email_User;

Hmm... hopefully it isn't like this throughout the script.
&function() is depreciated, and the function doesn't
actually
process @ARGV (which is the only reason to use &function )

#
---------------------------------------------------------------------
#lots more stuff goes in here....

sub Email_User {
    $sj="-s \"MyDirectory. file transfers\"";
    system("mail $sj " . "$email_addresses" . " <
.../MyDirectory/uploads/"
"$descrip");
    }
#
---------------------------------------------------------------------

> The html form that this script refers to, is very simple.
> It allows a user to fill out pertinent info about a file;
> Upload the file; and emails the contents of the form,
along
> with a link to the uploaded file (resides on our web
server)
> to whoever I put into the
>   $email_addresses = "blah\@blah.com,
blahblah\blah.com,etc";
> line.

Okay.

> My modification is this...
> I want to change the html form to included a customized
email
> that can be filled in by the user. I want THAT email
address
> used instead of the pre-filled in emails that were
previously
> put into the $email_address area.

How this is done depends on the strategy/modules used for
dealing
with CGI.  I bet this guy has worked with Perl4, and hence
I can
just see 'cgi-lib.pl' coming.  :(

The problem itself, is indeed, very simple.

> I do not know enough about Perl to have it point to that
line
> on the form for the email address. My ultimate goal would
be
> to CC: to another email. We are a newspaper and the
'files'
> would be ad proofs to customers. the CC: would go to ad
reps
> to let them know/see that a proof was delivered.

Easy, you need to read the man page for mail:

man mail

> I have reference books and I am learning but need some
> direction. This seems like a simple thing to do. Can
someone
> help?

Maintaining code is a horrible way to learn a language, if
you get stuck then email *ME* the whole script. 
Unfortunately,
I'm a student and it's coming up to a big deadline so I'll
only
be able to spend a little time on it (<60 mins).

Take care,

Jonathan Paton

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About