Solved

Attachments with smtp clients..

Posted on 2000-04-10
2
281 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 25 total points
Comment Utility
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
Comment Utility
listening...
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

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…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now