on 12-18-2014 8:01 PM
Hi Experts!
Is it possible to create a csv or txt file with just data (strings) and attach it to a mail?
If so, how could it be achieved?
Thanks in advance!
Hi Oscar,
I created this example to send a txt file:
import com.sap.odp.api.util.NotificationUtil;
import com.sap.odp.api.comp.messaging.MailTypeEnumType;
Properties params = new Properties();
params.put(new String("TOKEN1"), "Token 1");
String[] recipients = {"test@gmail.com"};
sender = session.getAccount();
mailTypeEnum = new MailTypeEnumType(MailTypeEnumType.ODP_CUSTOM_TEMPLATE1);
/*String to a ByteArrayInputStream*/
String fileContent = "Test attachment 1\nTest attachment 2\nTest attachment 3\n";
InputStream inputStream = new ByteArrayInputStream(fileContent.getBytes());
/*Send the email with the file name Test.txt*/
NotificationUtil.sendNotification(recipients,sender, mailTypeEnum,params,"FileName.txt",inputStream);
Regards,
Francisco.
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.