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.
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.
An IDE is no substitute for an Intelligent Developer.