aspose file tools*
The moose likes Linux / UNIX and the fly likes if file exists, then send email with attatchment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "if file exists, then send email with attatchment" Watch "if file exists, then send email with attatchment" New topic
Author

if file exists, then send email with attatchment

Greg Mendez
Greenhorn

Joined: Aug 23, 2010
Posts: 5

I am using:
- HP UX version 11.
- C Shell.

How do I write a script, if *.bad files exist, send an email with those files attached.

By the way, when I do this:

I will get garbage as attachment.

When I do this, the attachment comes out ok but subject parameter is not allowed.


Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16141
    
  21

I'm not sure mail/mailx supports attachments. You may be better off using mutt or something like that.

The Internet email system was designed to be able to route mail through a variety of systems, including IBM mainframes (EBCDIC, not ASCII) and even some that had byte sizes other than 8 bits. Thus, a fundamental constraint was that all email context had to be representable using a basic 7-bit character set that could be freely translated between all these different platforms.

Your attempt to use uuencode is on the right track, but what you really want is MIME encoding. MIME encoding has 2 parts: 1), conversion to character-only format and 2) MIME encapsulation. MIME encapsulation is done by including a special header line in the email text that indicates that an attachment follows and what character sequence will be terminating it. It also tells what kind of data is in the attachment, such as text/html or image/jpeg.

For more on that topic, consult the Internet RFCs. But unless you really want to get into it, an attachment-friendly email app is probably a better choice.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: if file exists, then send email with attatchment