gcoates has asked for the wisdom of the Perl Monks concerning the following question:
sub email_results { my %vars = $cgi->Vars(); my $msg = MIME::Lite->new ( From => $email, To => $email, Subject => 'Credit Card Survey Results', Type => 'multipart/mixed' ); my $body = (); my $csv = '"'; foreach my $key (sort keys %vars) { $body .= "$key: $vars{$key}\n"; $csv .= "$vars{$key}" . '","'; } chop($csv); chop($csv); $msg->attach ( Type => 'TEXT', Data => $body ); my $attachment = MIME::Lite->new ( Type => 'text/csv', Data => $csv, Disposition => 'attachment' ); $attachment->attr('content-type.name' => 'survey.csv'); $msg->attach($attachment) or die "Error attaching CSV file: $!"; $msg->send(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MIME::Lite truncating attachment
by jethro (Monsignor) on Jul 01, 2008 at 02:00 UTC | |
|
Re: MIME::Lite truncating attachment
by pc88mxer (Vicar) on Jul 01, 2008 at 01:48 UTC | |
|
Re: MIME::Lite truncating attachment
by bradcathey (Prior) on Jul 01, 2008 at 12:27 UTC | |
by jethro (Monsignor) on Jul 01, 2008 at 14:24 UTC | |
by gcoates (Novice) on Jul 01, 2008 at 16:43 UTC |