Solved

what do I have to do to mail a file?

Posted on 2001-08-30
4
146 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
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…

734 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