Solved

Attachments with smtp clients..

Posted on 2000-04-10
2
284 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
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
simple java question 3 59
oracle 11g 23 107
hashmap order 17 37
Using jdbcTemplate.batchUpdate to improve INSERT performance 6 22
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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…

861 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