on 2011 Nov 15 2:03 PM
Hi,
I am trying to attach a file in mail, I wrote the below code:
// Set a file as an attachment. Uses JAF FileDataSource.
// Create and fill first part
MimeBodyPart p1 = new MimeBodyPart();
p1.setText("abcd");
// Create second part
MimeBodyPart p2 = new MimeBodyPart();
// Put a file in the second part
String fileName = "try.txt";
DataSource fds = new FileDataSource(fileName);
p2.setDataHandler(new DataHandler(fds));
p2.setFileName(fileName);
// Create the Multipart. Add BodyParts to it.
Multipart mp = new MimeMultipart();
mp.addBodyPart(p1);
mp.addBodyPart(p2);
// Set Multipart as the message's content
msg.setContent(mp);
Transport.send(msg);
But getting error:
Error executing script: Sourced file: inline evaluation of: ``import com.sap.odp.api.util.; import java.util.; import javax.mail.*; import j . . . '' : Method Invocation Transport.send.
Please suggest if I am missing something.
Thanks,
Saloni
Request clarification before answering.
Resolved.
Filename path was not correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.