cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Cloud SDK : Send Email With attachment using New Email Functionality

Former Member
0 Kudos

Hi Experts,

I have try send email through the Reuse Functionality as posted by Alessandro Iannacci

I can able to send email using the above new functionality but i don't know how to add existing attachment to the email and send email with multiple attachment.

Can anyone have idea or try to send email with attachment using new email functionality?

Please share your idea.

Regards,

Mithun

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi     

Did attachment thing worked for you?

Thanks

saruchi

Former Member
0 Kudos

Hi SARUCHI PATHELA,

No, We have tried but not getting any success in it.

Please let me know once you achieve it.

Thanks in Advance........!!!!!!!!!!!!

Regards,

Mithun

former_member200567
Active Contributor
0 Kudos

Hi Mithun,

It works for me with the following :

import ABSL;

import AP.PlatinumEngineering as Platinum;

import DocumentServices.Global;

import AP.Common.GDT;

var Receipients :EmailRecepientDataTable;

var EmailReceipient :EmailRecepientData;

var SendFromURL :XPEString;

var EmailBodyTab :XPEStringTab;

var instance :EmailRecepientData;

var EmailSubject :XPEString;

var EmailFrom :EmailURI;

var atts:collectionof Platinum: Attachment;

var att:Platinum: Attachment;

///////////////////////////////////////////////////////////////

var ATTACHMENT_TYPE_DOCUMENT : DocumentTypeCode;

ATTACHMENT_TYPE_DOCUMENT.content = "10001";

// create PDF

var FormTemplateLanguage = "E";

var FormTemplateCode : OutputRequestFormTemplateCode;

FormTemplateCode.content = "FormTemplateHeaderCode";

var pdfDocument = OutputManagementUtilities.GetPDF(this, FormTemplateCode, FormTemplateLanguage);

if (!pdfDocument.content.IsInitial()) {

    Trace.Info("document successfully created");

  att.Binary=pdfDocument.content;

  att.FileName="hello.pdf";

  atts.Add(att);

}

///////////////////////////////////////////////////////////////

//1

EmailSubject=this.Subject;

//2

foreach(var t in this.ItemTextCollection.Text){

  EmailBodyTab.XPEString.Add(t.TextContent.Text.content);

}

//3

EmailFrom.content=this.MailFrom;

foreach(var receipient in this.Recipients){

  EmailReceipient.EmailRecepientTypeCode=receipient.EmailRecepientTypeCode;

  EmailReceipient.EmailUri.content=receipient.EmailRecepientMailAdd;

  Receipients.EmailData.Add(EmailReceipient);

}

if(!Receipients.IsInitial()){

  Mail.SendWithAttachment(EmailSubject,EmailBodyTab,EmailFrom,Receipients,true,atts);

}

Best Regards,

Fred

Former Member
0 Kudos

Thanks Fred K,

I will check and update you.

Thanks a lot for your valuable reply.

Regards,

Mithun

Former Member
0 Kudos

Hi

I have checked the attachment thing is not working for me as I have created the pdf form in custom BO and I am generating the pdf in custom BO Action generate_pdf from custom Adobe form.

But I have extended the Service ticket with an action to send email where I need to send that attachment created in custom BO in an email.

Hence I need to read that attachment created in custom BO in the XBO. But the attachment created in custom BO is of type binary and the one we are using to send in email is of Platinum: Attachment;.

var ATTACHMENT_TYPE_DOCUMENT : DocumentTypeCode;

ATTACHMENT_TYPE_DOCUMENT.content = "10001";

// create PDF

var FormTemplateLanguage = "E";

var FormTemplateCode : OutputRequestFormTemplateCode;

FormTemplateCode.content = "FormTemplateHeaderCode";

var pdfDocument = OutputManagementUtilities.GetPDF(this, FormTemplateCode, FormTemplateLanguage);

if (!pdfDocument.content.IsInitial()) {

    Trace.Info("document successfully created");

  att.Binary=pdfDocument.content;

  att.FileName="hello.pdf";

  atts.Add(att);     // att is of type Dependent:Engineering

So how I can read my attachment in custom BO which is of Binary and pass it to attachment in action send_email in the XBO of type Dependent Engineering.

former_member200567
Active Contributor
0 Kudos

Hi Saruchi,

My scenario is :

1. Create PDF from custom BO

2. Add a "Send Mail" button to OWL.

And it works as expected.

In your case,

1. You create one or more attachments to Attachment Folder of custom BO using its own form template

2. Send Email with one or more PDF from the Attachment Folder.

Am I right? I haven't tested but I think you can just retrieve Binary value from AttachementFolder and assign to att.Binary. Can't you?

Update :

I can send the attachments with the following:

if(this.Attachment.IsSet()){

  foreach(var doc in this.Attachment.Document){

  att.Binary=doc.FileContent.BinaryObject.content;

  att.FileName="hello.pdf";

  atts.Add(att);

  }

}

Best Regards,

Fred

former_member186648
Active Contributor
0 Kudos

Hi,

You can also read attachment via webservice "ManageAttachmentFolderIn".

Thanks, Pradeep.

Former Member
0 Kudos

Thanks Fred

I could read binary content and it worked for me.

thanks

Saruchi