?
Solved

Attachments with smtp clients..

Posted on 2000-04-10
2
Medium Priority
?
294 Views
Last Modified: 2010-03-30
I've developed a smtp client.  I'd like to know how can i send the attachments? The attachments cna be a file of any type..
0
Comment
Question by:jeet1
2 Comments
 

Accepted Solution

by:
misos8 earned 50 total points
ID: 2704710
Hello jeet1,
Inorder to send an attachement using the SMTP.
Here is the step.

1)After the "DATA" command is written out, u will need to send out the information of the MIME version . Like "MIME-Version: 1.0"

2) Then define the content type and the boundary for the data to be send as
"Content-Type: multipart/mixed; boundary=\"" + strboundary +"\"")"    where strboundary is some temporary string set as "abcdef"

3) End the header information and start ur information as
"\r\n--" + boundary"

4) Then start ur body part which is in text as
"Content-Type: text/plain; charset=\"us-ascii\"\r\n""

followed by the data in the body part.

"This is great\r\n\r\n"

end the body with the bounbary that u have defined
""\r\n--" +  strboundary"

5) Now the specifyfor the attachement as

""Content-Type:image/gif; name="+FileName" where FileName is the name of the attachement which the recipient will see as. Content type will be dependend on what u want to send it. It it is binary encode it.

6) U will then specify that u want as attachement else it will show up as part of the message.

"Content-Disposition: attachment;filename=\""+FileName+"\""""

7) U will specify the type of encoding as
"Content-transfer-encoding: base64\r\n"  

8)Then u will write the encode as
"QORIUEQRUQUREQOQUQU" etc

9) And incidate that u have ended the file as
""\r\n--" + strboundary"

10) Then specify the overall end of the message as
""\r\n\r\n--" + strboundary + "--\r\n""

11) Then specify the end of it by
"."

12) Then close it using
"QUIT"

Hope this answers ur quesiton.

Misos8.
0
 
LVL 5

Expert Comment

by:mbormann
ID: 2708875
listening...
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question