• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

if file exists, then send email with attatchment

 
Greg Mendez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 18100
51
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic