• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sending mail with body and attachment

 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • 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.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • 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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic