• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 153
  • Last Modified:

what do I have to do to mail a file?

I got a a file that I need to mail upon completion of the the cgi execution.... any hints?
btw.... it's a form that gets filled out, stored in a file then I wanna mail it,
Kejtar
0
Kejtar
Asked:
Kejtar
  • 3
1 Solution
 
builder110697Commented:
If you need an email send as a result of a cgi execution...  However it is a little
more involved to send an attached file.  But, the Mail::Sendmail module will do it.
Check the manual when you download the module.

Here's a CGI script that accepts, verifies, and uses an email address...
You should be able to adapt...

    #!/usr/bin/perl

    use CGI qw( :standard :html );
    use CGI::Carp qw( fatalsToBrowser );
    use Mail::CheckUser qw( check_email );
    use Mail::Sendmail;

    $REQUIRED="<img src=/images/reqd_flag.gif>";

    if ( param('displayed_once_already') ne "" ) {
     if ( ! check_email( param('email')) ) {
       $redo_email = "<br><font color=red> Please re-enter email address</font>";
     }
    }

    if ( ( param('email') eq "" ) || ( $redo_email ne "" ) ) {
     print header()
         . start_form()
         . hidden( 'displayed_once_already', 'true' )
         . "Enter your email address: "
         . textfield('email',"", 50), "$REQUIRED $redo_email\n"
         . submit("press to continue")
         . endform()
         . "$REQUIRED Required field"
         . end_html();
    }
    else {
     my %mail = (
         To => param('email'),
         From => "me\@mysite.com",
         CC => "me\@mysite.com",
         Subject => "I have received your email address",
         Message => "Thankyou for visiting mysite.com\n\nSincerely,\nMe");
     sendmail( %mail ) || die $Mail::SendMail::error;

    }
0
 
KejtarAuthor Commented:
ok.... unless I am missing it, there is nothing here about the attachements... if you could post a link that would be good...

Kejtar
0
 
KejtarAuthor Commented:
ok.... unless I am missing it, there is nothing here about the attachements... if you could post a link that would be good...

Kejtar
0
 
KejtarAuthor Commented:
This doesn't really lead me to where I want to go, but I am going to resolve it in another way.....

Kejtar
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now