cmp1 has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I am trying to find and use some code to use sendmail, in a webform and cgi to attache a file to an e-mail and send it. It is to run on a secure web site. I am not a programmer and have been trying to teach myself a crash course of Perl in like 4 days.

We have a Red Hat Linux running RH 7.2 and Apache 1.3 with a application using Tomcat. Send mail is also on and running on this machine. The one application running on the secure web takes an attachment already but converts it or runs it through a process for HIPPA. ( we process medical insurance claims) But we can not use this for just sending files / having people upload a file, so need to find something else to take care of all other files. The e-mail program from CPAN would be great.

My project is to have a means for people to upload a file to the server. It does not have to be by e-mail but being able to do it as an e-mail with an attachement would be the best way to go. SO this is what I am trying to do. I have been searching the net for code and also at CPAN. The biggest problem is I seem to see the solution, but it is in parts and peices and I am having troubles trying to put it all together into one cgi and html form. I have included a solution I want to use from CPAN. What I am looking for is a complete section of code to do the job and tell me to save it as file name "whaterver.cgi" and copy into my cgi-bin and then the other complete line of code that is the html form and to put that "html-form.html" into my apache/htmdocs.

I have purchased my Perl for Dummies book & Perl, CGI and Java Script book to try to read up on and to teach myself Perl. I am not having very good luck. I have been working on this for about 4 days. Again this just has to be simple, generate an e-mail and attach a file of any size such as word doc, *.XLS, *.PDF or what ever.

I wish I was skilled enough right now to pull out all the parts needed from the source below to make my cgi code that I need and then the simple htlm form that calls the cgi. I have lost the forest in the trees.

I am sorry for being so new and green and asking this question.

Sincerely,

Chad c-paul@netexpress.net

I tried to attach the code but it made the post look like junk. The code at CPAN that I want to use is called

NAME Mail::Sender - module for sending mails with attachments through an SMTP server

Version 0.8.10

http://search.cpan.org/~jenda/Mail-Sender-0.8.10/Sender.pm

20041011 Edit by ysth: add p tags

Replies are listed 'Best First'.
Re: sending mail with attachments
by cmp1 (Initiate) on Oct 11, 2004 at 16:22 UTC
    Update note, I did manage to figure a little more out. I have the mail-sender-0.8.10 downloaded and unzipped. I printed out the source to see the dependencies / required *.pm s I will see what the server has and download all that I need and try to run the makefile on each of them to install them. My Unix / Linux skills are at beginner level. the computer staff is just myself and my manager and neither of us are programmers or strong in unix. But I have a test system to work on so all is safe to try things and learn. Chad
      I'd like to recommend a module written by [id://gmpassos], Mail::SendEasy - it requires no dependencies, save for Archive::Zip, and then only if you need to compress. It sends MIME attachments. Very flexible and easy to get up and running..

      It sounds to me like you would benefit from hiring a professional to get you started on that project -- that way you'd get it done correctly and quickly, and as you learn, you could begin maintaining or expanding the code yourself. Unfortunately Perlmonks is better a place for specific questions and discussions, as opposed to a place to post requests to write entire production apps for you - better jobs.perl.org for that :)

Re: sending mail with attachments
by Tii (Monk) on Oct 12, 2004 at 02:23 UTC

    Don't take this as me being negative, but I don't think that it is very likely that you will find code that does exactly what you need it to without any adjustments or modifications.

    I'd recommend that you break the task down into smaller pieces and tackle it that way. With this approach, you can ask specific questions at each stage.

    Also: if/when you find the module(s) that you need to help you get the job done, you should use the CPAN module to install them. It takes care of making sure all of the dependencies are resolvedtomatically. The CPAN module comes with perl version 5.004 and later.

    To run the CPAN module, type:
    perl -MCPAN -e shell

    It takes a few minutes to set up, but you will find it worthwhile.

    Tii
Re: sending mail with attachments
by gellyfish (Monsignor) on Oct 12, 2004 at 09:51 UTC

    You might want to see the NMS TFmail which includes the capability to send an uploaded file by e-mail.

    This will probably be simpler if you are not a programmer.

    /J\