CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
attn: Jasmine - sending attachments

 



jacksonpt
Deleted

Jun 29, 2000, 6:52 AM

Post #1 of 4 (1000 views)
attn: Jasmine - sending attachments Can't Post

I saw a post below, and this is along similar lines. I want to send a text message with an HTML file as an attachment. This HTML file is producted dymanically from information collected via a form. Can I use MIME-Lite for this as well? I skimmed over the text at the link supplied in the post below, and it seems like MIME will do just what I want, I am just a bit unclear how to go about it.

Thanks,
-Jackson


Jasmine
Administrator

Jun 29, 2000, 7:54 AM

Post #2 of 4 (1000 views)
Re: attn: Jasmine - sending attachments [In reply to] Can't Post

The key is to create and save the file first. You can't attach a file that doesn't exist Smile So have your program generate the HTML file, save it on your server, attach and email it using MIME::Lite, then delete (unlink) it unless you want to keep it.

Good luck!


Kanji
User

Jun 29, 2000, 8:24 AM

Post #3 of 4 (1000 views)
Re: attn: Jasmine - sending attachments [In reply to] Can't Post

Randal Schwartz's Uploading Files and Sending MIME Mail could save you a lot of time. Smile


jacksonpt
Deleted

Jun 29, 2000, 9:29 AM

Post #4 of 4 (1000 views)
Re: attn: Jasmine - sending attachments [In reply to] Can't Post

I am having trouble getting it going... do I have to do any initializing for the $msg->send; line? Here is what I've got:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#!/usr/bin/perl

$mailagent = '/usr/lib/sendmail';

&parse_form_data(*input);
&print_table;
&setup_email;
&notify_user;
exit(0);

sub parse_form_data {
# does most of the form work
}

sub print_table {
#overwrites the existing HTML file
}


sub setup_email {
open (MAIL, "|$mailagent $recipient") | | die "Can't open $mailagent!\n";
$message = MIME::Lite->new(
From => 'jtaylor@binghamton.edu',
To => 'jacksonpt@stny.rr.com',
Subject => 'Job Listing',
Type => 'text/html',
Encoding => 'base64',
Path => 'test.htm'
);
$message->send;
}


sub notify_user {
# displays confirmation message to user
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks again.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives