The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
mailx commannd - Mail and Attachment in same mail sharif UNIX for Advanced & Expert Users 6 03-19-2008 04:25 PM
HTML message with attachment (text-file) Felix2511 UNIX for Dummies Questions & Answers 2 09-12-2007 02:59 AM
Problem while sending message and attachment with mailx nihar.dutta Shell Programming and Scripting 2 08-09-2007 11:15 AM
AIX send mail with HTML message body and a binary attachment G-Man UNIX for Dummies Questions & Answers 4 03-22-2007 02:15 PM
email attachment, with a message using mailx edog UNIX for Advanced & Expert Users 4 09-28-2001 01:03 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-15-2004
tine tine is offline
Registered User
  
 

Join Date: Apr 2003
Location: Amsterdam - the Netherlands
Posts: 40
mail message attachment not complete

Hi,
I use MIME::Lite to send an e-mail with an attachment:
$msg = MIME::Lite->new(
From =>$usermail,
To =>$tomail,
Subject =>'Nieuw Pegasus Adresboek',
Type =>'multipart/mixed'
);

$msg->attach(Type =>'TEXT',
Data =>$message
);
$msg->attach(Type =>'text/plain',
Path =>'/home/ldap/data/tine/pm_hva.txt',
Filename =>'pm_hva.txt',
Disposition => 'attachment'
);

$str = $msg->as_string;

$msg->print(\*SENDMAIL);

The problem is that the attachment is not sent complety.
It stops somewhere near the end of the file. In the file i can't find anything strange and also it happens at different lines/locations in the file..
Can anyone please help?

Tine
  #2 (permalink)  
Old 03-15-2004
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
  
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
since you are useing single quotes it might not interperate the PATH correcly. try useing double quotes.

from the POD
http://search.cpan.org/~yves/MIME-Li...t_to_a_message

Code:
### Create the multipart "container":
    $msg = MIME::Lite->new(
                 From    =>'me@myhost.com',
                 To      =>'you@yourhost.com',
                 Cc      =>'some@other.com, some@more.com',
                 Subject =>'A message with 2 parts...',
                 Type    =>'multipart/mixed'
                 );

    ### Add the text message part:
    ### (Note that "attach" has same arguments as "new"):
    $msg->attach(Type     =>'TEXT',
                 Data     =>"Here's the GIF file you wanted"
                 );

    ### Add the image part:
    $msg->attach(Type     =>'image/gif',
                 Path     =>'aaa000123.gif',
                 Filename =>'logo.gif',
                 Disposition => 'attachment'
                 );
  #3 (permalink)  
Old 03-16-2004
tine tine is offline
Registered User
  
 

Join Date: Apr 2003
Location: Amsterdam - the Netherlands
Posts: 40
unfortunately it didn't help.
It does use the right file, it just doesn't use the whole of the file..
  #4 (permalink)  
Old 03-16-2004
tine tine is offline
Registered User
  
 

Join Date: Apr 2003
Location: Amsterdam - the Netherlands
Posts: 40
I found out what was causing the problem..

The file i was trying to send was made in the same script before sending it:
foreach $key (@keys){
print pegasus_file $temp_naam{$key};
}

and i didn't close the file..
so it seemed to send the file before it was filled completely!

a simple
close(pegasus_file);
solved all my worries!

  #5 (permalink)  
Old 03-16-2004
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
  
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
yeah it does help to finish printing to the file handle befor moveing it away. heh.

glad you found the problem.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0