PDA

View Full Version : how to send a image through email using java coding


shree
10-01-2005, 12:48 PM
hi all,

i want to send an image with some details to particular users through mail.

using java coding is it possible??

or i have to use third party tool which can be written in java.

its urgent pls........

i am waiting for reply.
thank you one and all.

suryad
10-11-2005, 09:29 AM
It can be done but the javamail api is a mess. If you are further interested, I can try and help you out a bit more. This is a rather old thread so I want to make sure you respond to this before I go off on my spiel! :D

shree
10-13-2005, 10:35 AM
thank you for your reply.

i had tried and got the solution using Java Mail and Inet product.

EmailMessage email = new EmailMessage();

// set recipient address
email.setTo(to);

// set from address
email.setFrom(" ");

// set subject
email.setSubject("");

// set body
email.setBody(body);

// add file attachment to message
email.addAttachment(new Attachment(new File(attachment)));

// send email message
smtp.send(email);

At present it is working with the help of inet pacakage. but i have one doubt.

is it possible without using third party code can we write java code for sending attachments.
thank you for your reply.
shree