commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashish Naik" <ashi...@mahindrabt.com>
Subject How to attach a file to email
Date Thu, 03 Jun 2004 12:01:32 GMT

I am trying to send an email with attachment. The code below sends the file
in-line. How to send as attachment?

client.setSender(this.senderEmail);
client.addRecipient(this.recepientEmailAddress);
header = new SimpleSMTPHeader(this.senderEmail, this.recepientEmailAddress,
this.emailSubject);

fileReader = new FileReader(fileName);
writer = client.sendMessageData();

if (writer != null)
{
 writer.write(header.toString());
 Util.copyReader(fileReader, writer);
 writer.close();
 client.completePendingCommand();
}



Cheers,
Ashish Naik




*********************************************************
Disclaimer:          

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message