Solved

Attachments with smtp clients..

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
stackato and cloud 4 85
javap bin 2 34
hibernate jars 4 30
Is there a simpler dropbox system? 10 20
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

770 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