• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Sending mail with body and attachment

 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I am trying to send email from unix server that has body and attachment both. But I am successful in sending either body or attachment. I have done a lot of goggling on it but could not find anything. Can anyone please help me on this.





Nothing worked for me. It attches the body in garbled character in the mail itself.

Please advise something on it.

Thanks,
Patricia.
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to the manpage of uuencode and common shell knowledge, you have to specify stdout (-) as filename if you want to pipe your output to mailx.

However, I don't know whether the part right to the pipe is right - I don't run a mailserver and get an error about a missing default user.
 
Saloon Keeper
Posts: 26039
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The entire content of email is text from start to finish. If you were wondering how this allows attaching images, videos, viruses, and other non-text items, the answer is that uuencode converts the raw binary to a series of text characters, although this means that the MIME-encoded attachment will be somewhat bigger than the original binary data. The email format RFC also outlines the special text lines that are used to delimit attachments, so that they won't be mistaken for general email message text.

In case you were wondering why the insistence on text, it's because when the original standards were set up, a lot of the computers involved were IBM mainframes, which use EBCDIC instead of ASCII. Some of the original Internet machines had even stranger restrictions, such as 6-bit character codes. So MIME made it possible for a simple standard to work equally well for all of them. As a side benefit, you can easily test a lot of this stuff using simple telnet logins, and you can diagnose content with common text utilities instead of specialized one-of-a-kind binary applications.

You can build up the entire email, attachments and all by brute force text manipulation, but in actual practice, we cheated and used mutt as our batch mail agent.
 
Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic