Just curious, how would you send an attachment?


Johnathan Kupferer wrote:
> 
> Aww... you should have let him hire a consultant.  ;o)
> 
> Seriously though, this is dead simple.  Gary's code is great and robust
> if a bit intimidating for a newbie.  You said you have background in
> VisualBasic and that would lead me to think you might be using windoze
> NT or 2000.  (Unfortunately, so am I).  If this is the case, you
> probably don't have access to sendmail, in which case I suggest you take
> a look at the Mail::Sendmail module.  The only info you need to
> configure it is an SMTP server.  (If you are using win32 and
> ActiveState, this can be found using ppm).  Lots of people also use a
> program called Blat, but I don't like it because it forces you to write
> a file to disk first...
> 
> To get the form info:
> 
> use CGI;
> my $cgi = new CGI;
> 
> #
> # $cgi->param returns a list of the fields in the form when not
> # given any arguments.  Passed a field name, it returns the value.
> # I'm not sure how you mean tab delimited, so I'll leave that to
> # you...
> #
> for my $field ($cgi->param){
>    $message .= "$field = ".$cgi->param($field)."\n";
> }
> 
> #
> # Now just send it!
> #
> use Mail::Sendmail;
> sendmail (
>        To             => $email_to,
>        From           => '[EMAIL PROTECTED]',
>        Subject        => "Email Subject"
>        Message        => $message
> );
> 
> With that said, I hope you see that this is really quite simple.  Gary's
> code takes into account alot of details like what to do if we don't know
> what mail program to use and giving a response back to whoever submitted
> the form which is generally a good idea so you should definitely follow
> his lead even if you're not on Unix.
> 
> As for publicly available base code...  I don't know.  This is actually
> a bit too simple to expect to find base code, but you never know.  But
> hey!  We're the public and here's a bunch of code!
> 
> Good Luck,
> 
> - Johnathan

Reply via email to