Hello,
I have been working on a simple Perl script that would allow people to send an e-mail and attach a file from thier computer. The server I am running is UNIX I believe. The problem is that I can attach files to the e-mail that are on the server, ie. "/home/ However, for my purposes I need the user to be able to attach a file from thier comptuer, ie. "C:\text.txt". When I try to do this, I recieve an 500 Internal Server Error. Could you please assist me in doing this? The script I wrote is located Below.
###########################################################
#!/usr/bin/perl
use MIME::Lite;
use Net::SMTP;
use strict;
use warnings;
my $from_address = 'jbarkawi@infinitetiers.com';
my $to_address = 'jbarkawi@infinitetiers.com';
my $subject = 'MIME Net::SMTP test';
my $mime_type = 'TEXT';
my $message = "Hello world!\n";
my $mime_msg = MIME::Lite->new(
From =>$from_address,
To =>$to_address,
Subject => $subject,
Type => $mime_type,
Data => $message
);
my $filename = 'C:\test.txt';
$mime_msg->attach(
Type => "application/txt",
Encoding => "base64",
Path => $filename,
Filename => "resume.txt");
MIME::Lite->send('smtp', 'localhost', Timeout =>20);
$mime_msg->send;
##########################################################
With kind regards,
Joe Barkawi
Software Engineer
Infinite Tiers, Inc.
I have been working on a simple Perl script that would allow people to send an e-mail and attach a file from thier computer. The server I am running is UNIX I believe. The problem is that I can attach files to the e-mail that are on the server, ie. "/home/ However, for my purposes I need the user to be able to attach a file from thier comptuer, ie. "C:\text.txt". When I try to do this, I recieve an 500 Internal Server Error. Could you please assist me in doing this? The script I wrote is located Below.
###########################################################
#!/usr/bin/perl
use MIME::Lite;
use Net::SMTP;
use strict;
use warnings;
my $from_address = 'jbarkawi@infinitetiers.com';
my $to_address = 'jbarkawi@infinitetiers.com';
my $subject = 'MIME Net::SMTP test';
my $mime_type = 'TEXT';
my $message = "Hello world!\n";
my $mime_msg = MIME::Lite->new(
From =>$from_address,
To =>$to_address,
Subject => $subject,
Type => $mime_type,
Data => $message
);
my $filename = 'C:\test.txt';
$mime_msg->attach(
Type => "application/txt",
Encoding => "base64",
Path => $filename,
Filename => "resume.txt");
MIME::Lite->send('smtp', 'localhost', Timeout =>20);
$mime_msg->send;
##########################################################
With kind regards,
Joe Barkawi
Software Engineer
Infinite Tiers, Inc.