my $smtp = Net::SMTP->new($host); $smtp->mail($myemail); $smtp->to(@emails); # Start the mail $smtp->data(); my $dispName = "Test Attachment"; # Send the header. $smtp->datasend("To: Myself\n"); $smtp->datasend("From: Me\n"); $smtp->datasend("Reply-To: $myemail\n"); $smtp->datasend("Subject: Test email\n"); $smtp->datasend("Content-Disposition: attachment; filename= $dispName\n"); ???? Is this right ??? $smtp->datasend("MIME-Version: 1.0\n"); $smtp->datasend('Content-Type: multipart/mixed; boundary= "--*B*--"\n\n'); ??? Is this right ???? # Send the body. $smtp->datasend("--*B*--\n"); $smtp->datasend("Content-Type: text/plain\n"); $smtp->datasend("This is a test email\n\n"); # Send attachemnt my $buffer = ""; my $file = "Test.txt"; open (MAIL, "<$file") or die "ERROR: Could not open email file"; while () {$buffer .= $_} close (MAIL); $smtp->datasend("--*B*--\n"); $smtp->datasend("Content-Type: application/text; name= \"$file\" \n"); ???? Is this right???? $smtp->datasend("\n"); $smtp->datasend("$buffer\n\n"); # Finish sending the mail $smtp->dataend(); # Close the SMTP connection $smtp->quit;