mail message attachment not complete


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting mail message attachment not complete
# 1  
Old 03-15-2004
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  
Old 03-15-2004
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  
Old 03-16-2004
unfortunately it didn't help.
It does use the right file, it just doesn't use the whole of the file..
# 4  
Old 03-16-2004
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!

Smilie
# 5  
Old 03-16-2004
yeah it does help to finish printing to the file handle befor moveing it away. heh.

glad you found the problem.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Sending email with message body and attachment

Hello experts!! I am trying to send an email with message body and attachment.but i am getting any one like message body or attachment. I tried below command: (echo "subject:test";echo "MIME-Version: 1.0";echo "content-transfer-encoding:base 64";echo "content-type:txt;name=test.txt";cat... (2 Replies)
Discussion started by: Devipriya Ch
2 Replies

2. UNIX for Dummies Questions & Answers

Mimesender (Perderabo): no attachment in email message

Hello, all, I have been trying to use what Perderabo has given to send attachment via email., but I am not getting the attachments, what I see on the receiving email system are the attachments contents inside the body of the received email. No attachment icon shows in the received email. I am on... (3 Replies)
Discussion started by: gio001
3 Replies

3. Shell Programming and Scripting

Mailx with attachment and message body

i have to attach the 'body in the email' along with attachment below code is throwing errors, how can i do it ? here body file contains message, it should display in email, please help i am using HP-UX (cat body ;) (uuencode attch1 attch1 ;) | mailx -m -s "testing" "abc@gmail.com" ... (4 Replies)
Discussion started by: only4satish
4 Replies

4. UNIX for Dummies Questions & Answers

How to send html file in a mail not as an attachment but it should display in the mail in table for

Hi The below script working when we are sending the html as attachment can u please guide how to send thesmae data in table form direct in the mail and not in mail attachment . cat Employee.sql SET VERIFY OFF SET PAGESIZE 200 SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON - HEAD... (0 Replies)
Discussion started by: mani_isha
0 Replies

5. Shell Programming and Scripting

Mail attachment with unix mail

Hi Could someone help me with the details on how to send an attachment through mail in unix. I have an html file in my unix machine and I want this to be send to some mail id, plese help with the steps. Regards Ajay (2 Replies)
Discussion started by: ajaykumarboyana
2 Replies

6. UNIX for Advanced & Expert Users

mailx commannd - Mail and Attachment in same mail

Hi , I am using mailx command for sending the mails. Rightnow I am sending the attachment (by using uuencode $filename) as a seperate mail.I wanna send the attachment also with the same mail. (6 Replies)
Discussion started by: sharif
6 Replies

7. UNIX for Dummies Questions & Answers

HTML message with attachment (text-file)

Hello: I've searched de forum but could not find an answer to send an email via sendmail in HTML with an text-file (plain-text) as attachment: My code: export FROM="Me" export MAILTO="mymail" export SUBJECT=$TITULO$bbdd export BODY=$LOG ( echo "FROM:$FROM" echo "To: $MAILTO"... (2 Replies)
Discussion started by: Felix2511
2 Replies

8. Shell Programming and Scripting

Problem while sending message and attachment with mailx

Hi All, I am trying to send a mail with an attachment and message. Following command I am using. (cat <messagefile> ; uuencode <attachmentfile> <attachmentfile>)|mailx -s"Subject" dave@email.com In the received mail, message body is appearing fine. But attachment is not coming. Rather... (2 Replies)
Discussion started by: nihar.dutta
2 Replies

9. UNIX for Dummies Questions & Answers

AIX send mail with HTML message body and a binary attachment

I'm trying to script sending an e-mail message on an AIX 5.x server with the following requirements: 1. command line switch to specify file name containing message body in HTML format 2. command line switch to specify file name of a binary attachment 3. command line or input file to specify... (4 Replies)
Discussion started by: G-Man
4 Replies

10. UNIX for Advanced & Expert Users

email attachment, with a message using mailx

Hi, I am trying to include a message along with an attachment with an email using mailx on AIX. uuencode Test.dat Test.dat| mailx -s 'Testing' mymail@yahoo.com < MESGFILE This only gives me the contents of MESGFILE as my message. If I remove the < FILE I recieve the attachment. What... (4 Replies)
Discussion started by: edog
4 Replies
Login or Register to Ask a Question