Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Used MIME::Lite to send smtp email & crashed server 1

Status
Not open for further replies.

jcarrott

Programmer
May 28, 2009
130
US
I used the MIME::Lite module and sent an email with 2 attachments. It worked going to various users on our system.

The first test to a vendor crashed their email server. The system crashed when they double clicked on the email to open it.

Code:
#! /usr/bin/perl -w
use MIME::Lite;
                  
$vPath1   = 'D:\\Inetpub\\ftproot\\Email';
$vName1   = 'D:\\Inetpub\\ftproot\\Email\\emailout.bak';
$vName2   = 'D:\\Program Files\\OHS\\Email\\Email_Cover_Sheet.rtf';
$message  = 'Attached is a PO from Ochsner Health System and instructions.';
$Priority = 1;

$rc=system("cd $vPath1");

open(IN, "$vName1") or die 'Could not open emailout.bak';

foreach (<IN>)
{

    chomp;
    my @field  = split /,/;
    $sendTo = $field[3];
    $fileNm = $field[0];
    $vName3 = "D:\\Appdata\\Email\\" . $fileNm . ".pdf";

    $msg = MIME::Lite->new(
        From     => 'purchasing@ochsner.org',
        To       => $sendTo,
        Subject  => 'RE: PO FROM OCHSNER',
        'X-Priority' => $Priority,
        Type     => 'multipart/mixed');

    $msg->attach(
        Type    => 'TEXT',
        Data    => $message);
           
    $msg->attach(
        Type        => 'application/rtf',
        Path        => $vName2,
        Filename    => $vName2,
        Disposition => 'attachment');

    $msg->attach(
        Type        => 'pdf/pdf',
        Path        => $vName3,
        Filename    => $vName3,
        Disposition => 'attachment');

    $msg->send('smtp', 'smtp.ochsner.org');
}
close (IN);

$rc=system("del /Q D:\\Inetpub\\ftproot\\Email\\emailout.bak");

Does anything I am doing look like it could cause a system crash??
 
An update, the system we use is a Windows server and the email software is Novell GroupWise.

The Vendor system we crashed was a Mac system running Safire.

Is MIME::Lite compatible with a Mac system?
 
Where did you get "pdf/pdf" from? Was it a wild guess? There are standards that govern these things, you can't just pick something at random, see:


Try "application/pdf" perhaps.

Having said that, you shouldn't be able to crash an email client (let alone a system!?) that easily! I thought Safari (I'm assuming Safire was a typo) is a web browser... can it be used to read email too?

MIME::Lite compatibility is irrelevant here... you use it to construct an email. Once its job is done, that's all it has prdouced... an email, which should be standards compliant and readable on any operating system/hardware/email client combination that purports to be capable of reading emails.

Annihilannic.
 
I got the 'pdf/pdf' from an example. Thank you for the catch, I have changed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top