Solved

what do I have to do to mail a file?

Posted on 2001-08-30
4
142 Views
Last Modified: 2013-12-25
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
Comment
Question by:Kejtar
  • 3
4 Comments
 
LVL 1

Accepted Solution

by:
builder110697 earned 100 total points
ID: 6442521
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
 
LVL 1

Author Comment

by:Kejtar
ID: 6442633
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
 
LVL 1

Author Comment

by:Kejtar
ID: 6442634
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
 
LVL 1

Author Comment

by:Kejtar
ID: 6451291
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jQuery Generalization 3 64
Batch FIle delete files with particular date 10 76
User profile Size Report 3 64
Auto-indent certain lines in Notepad++ 10 32
The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now