[NTLUG:Discuss] mail or mailx question on attachments

Fred James fredjame at concentric.net
Thu Nov 21 22:25:26 CST 2002


We found a solution (I think) and I'd like your comments, please - 
especially if you can see a potential problem - we are still testing it, 
but it works so far.

Short story:
(1) A fairly simple piece of C takes 4 arguments and pipes a text 
message through "mailx -s subject_line email_address"; an (Oracle) 
PL/SQL package can pass those arguments to the shared object made from 
the C; and an Oracle Form can be put together to make a GUI for the users.
(2) Some of the other functions in this database produce reports in PDF 
format, and we needed a way to attach these reports to the email without 
totally reinventing the wheel.
(3) mailx has a group of "tilde escapes", some of which are:
      ~|command
      ~rt return_address
      ~s subject_line
      etc.
(4) So for example, a text file that contain the following for its first 
three lines:
      ~|uuencode filename.pdf filename.pdf
      ~rt joe at whereever.com
      ~s Hey Joe what do you know
would (a) attach the file "filename.pdf" to the email, (b) make the 
"Reply-To" address "joe at whateever.com", and make the "Subject" line read 
"Hey Joe what do you know".


David wrote:

>On Thu, Nov 21, 2002 at 10:23:15AM -0600, Fred James wrote:
>
>>Does anyone know how to send attachments with mail/mailx?  Attachments 
>>such as a PDF file.
>>Thanks in advance for any suggestions.
>>
>
>Making a proper MIME attachment with mail/mailx is very difficult, since
>MIME demands some elements in the message header and others in the
>message body.  Mail/mailx does not have any automated support for this.
>
>You might consider using "mutt" instead, which handles MIME very well.
>In mutt, you might do "% mutt -a attached-file -s subject to-address".
>

-- 
small is beautiful







More information about the Discuss mailing list