Service Desk Practitioners Forum

email with attachment using javax.mail to update Service Call

Vijay Kavrani
Outstanding Contributor.

email with attachment using javax.mail to update Service Call

I am using javax.mail.* classes to send an attachment to a Service call. There is a Domino server as SMTP Relay Host to which this update mail goes.

The Code looks like:

Multipart multipart = new MimeMultipart();
// Add part one
// Part two is attachment
// Create second body part
messageBodyPart = new MimeBodyPart();
// Get the attachment
DataSource source = new FileDataSource(filename);
// Set the data handler to the attachment
messageBodyPart.setDataHandler(new DataHandler(source));
// Set the filename
// Add part two
// Put parts in message
// Send the message

And here is the problem (what I see in logserver.txt):

Fri, 22/06/2007 11:11:58 Subject : Update 14634

Fri, 22/06/2007 11:11:58 To : [servicecall]
Fri, 22/06/2007 11:11:58 Plaintext :
Attachment added.
Fri, 22/06/2007 11:11:58 Attachments: [(.\test.txt : D:\Program Files\Hewlett-Packard\OpenView\service desk 4.5\server\tmp\895-.\test.txt!#! : text/plain;name=.\test.txt)]
Fri, 22/06/2007 11:11:58 Reply-To : null
Fri, 22/06/2007 11:11:58 Reply-To :
Fri, 22/06/2007 11:11:58 Mail from :

Fri, 22/06/2007 11:11:58 ReturnPath :
Fri, 22/06/2007 11:11:58 Importance : normal
Fri, 22/06/2007 11:11:58 Error when put file D:\Program Files\Hewlett-Packard\OpenView\service desk 4.5\server\tmp\895-.\test.txt!#! to attachment server: D:\Program Files\Hewlett-Packard\OpenView\service desk 4.5\server\tmp\895-.\test.txt!#! (The system cannot find the path specified)

The problem is that the attached file test.txt is being received on Service Desk server as .\test.txt and these two extra characters ".\" are creating an issue here. I am not sure where these two characters are getting inserted. Can anyone help please?