Skip to Content

[Tutorial] Sending Emails from ByD


EDIT – 2017-05-10

The scripting mentioned below seems to be now reprecated, however using the Platinum Engineer library seems that SAP has made it even simpler, I’m attaching the screen capture of the method itself, which I haven’t tried yet, but as soon as I do I’ll update you on this post:


Seems to be easier, isn’t it?


I’m leaving the original post as is, just for documentation reference.



Hi people, there’s a guide explaining the configuration needed to send an email from the internal Mail service included in ByD.


1. First of all, we need to create a domain, so access the ByD as a key User.


2. Then access the Business Configuration > Implementation Projects



3. Once in there, click the Open Activity List Button




4. Then go to the fine tuning tab, and in the search field type “Mail”, select the Mail and Fax Configuration, and click the “Open” Button



5. A new window will appear, Click the Email and Fax Settings link.. then..


6. In the Allowed Sender E-Mail Domains, click add, and write any domain, in this case my domain is

and leave the other fields as my caption, click save and close





7. Now we’re going to configure our personal Mail, based on the domain that we just added.

Go to the Home WorkCenter, and select the Self Services Overview, Inside the Company Address Book block, click the Edit my Contact Data Link.




8. In the EMail field, fill it with an email using the declared domain, click finish.



Now we are ready to test this up.


Use the script example in the PSM, in the EMail Activity section!





Many of you asked for the script to implement this, so there you go! 😀


On this example I created the QA with three input fields, 1 for the email title, another for the email where you want to send the message, and another with the actual message.



import ABSL;

import AP.FO.Activity.Global;


//EmailActivity: Root node

var elEmailRoot :  elementsof EmailActivity;

var instEmail;


// EmailActivity: define party node

var elEmailParty : elementsof EmailActivity.Party;

var instParty;



var TXT_TYPE_BODY_TEXT = “10002”;

var elEmailTxtCollTxt:      elementsof EmailActivity.TextCollection.Text;

var elEmailTxtCollTxtCntnt: elementsof EmailActivity.TextCollection.Text.TextContent;

var instEmailTxtColl;

var instEmailTxtCollTxt;



elEmailRoot.Name.content = this.asunto; //Here comes the title of the email




instEmail = EmailActivity.Create(elEmailRoot);




elEmailParty.PartyKey.PartyID.content =;         //The email address where you want to send it




instEmailTxtColl = instEmail.TextCollection.Create();

elEmailTxtCollTxt.TypeCode.content = TXT_TYPE_BODY_TEXT;

instEmailTxtCollTxt = instEmailTxtColl.Text.Create(elEmailTxtCollTxt);

elEmailTxtCollTxtCntnt.Text.content = this.contenido; //                           Here the message itself





Update: This script must have the save after execution indicator marked as true.

You must be Logged on to comment or reply to a post.
  • hi i followed this script. But I get an bellow error. what is this error mean?

    Mailing not possible; e-mail address does not exist for sender 8000000165

      • Thanks Alessandro. Issue Solved. I have filled my E-mail id in service agent. so now mail will go through my default E-mail id.  Can you suggest script for assigning username in program itself!

        • Hi Sankaran,

          Following is the code for to fill the user email address and email it to user from SDK

          //Elements of Email

          var emailActivityElements : elementsof EmailActivity;

          var emailActivityMessageFromPartyElements : elementsof EmailActivity.Party;

          var emailEmployeeResponsiblePartyElements : elementsof EmailActivity.Party;

          var emailActivityCC : elementsof EmailActivity.Party;

          var emailAcitivtyTo : elementsof EmailActivity.Party;

          var emailActivityEmailActivity : elementsof EmailActivity.Party;

          var emailActivityTextCollText : elementsof EmailActivity.TextCollection.Text;

          var emailActivityTextCollTextTextCont : elementsof EmailActivity.TextCollection.Text.TextContent;

          var employeeMailID;

          var employee;

          var employeeAdminMailID;

          var emailActivityInstance;

          employee = Employee.Identification.Retrieve(notification.Source);

          if (employee.IsSet())


              if (employee.ToParent.CurrentDefaultEmployeeWorkplaceAddressInformation.IsSet())


                  var employeeWorkPlaceAddressInfo = employee.ToParent.CurrentDefaultEmployeeWorkplaceAddressInformation;

                    if (employeeWorkPlaceAddressInfo.EmployeeWorkplaceAddressWorkplaceAddress.IsSet())


                          employeeMailID = employeeWorkPlaceAddressInfo.EmployeeWorkplaceAddressWorkplaceAddress.DefaultEMail.URI.content;




              //For display the subject accordingly


                  emailActivityElements.Name.content = "Reg: Test Email";

                  emailActivityInstance = EmailActivity.Create(emailActivityElements);

              // for assigning the To Party

              if (!employeeMailID.IsInitial())


                  emailAcitivtyTo.PartyKey.PartyID.content = employeeMailID;





                  raise Error/Info Messgaes accordingly


              //TextCollectionTextTypeCode 10002 -> Body Text

              var TxtTypeCode = "10002";

              var emailActivityTxtCollIns = emailActivityInstance.TextCollection.Create();

              emailActivityTextCollText.TypeCode.content = TxtTypeCode;

              var emailActivityTxtCollTxtIns = emailActivityTxtCollIns.Text.Create(emailActivityTextCollText);


              //To Display the Message Note


                  emailActivityTextCollTextTextCont.Text.content = "Dear Recipient," + "\n \n" +

                  "Text Needed ";


              var emailActTxtCollTxtTxtCont = emailActivityTxtCollTxtIns.TextContent.Create(emailActivityTextCollTextTextCont);

              //If Instance is Set then Send the mail

              if (emailActivityInstance.IsSet())




          Please try this and this should work.



          • Hi hanumanth, very  much happy to see your reply. Yep I got an answer. That's not a matter.  A mail has been triggered successfully. But I need to specify my 'From address' as like 'To addres' in my coding. I think, in your script, 'from address' is static, which ll take service agent mail Id. In above coding, yu declared 'var employeeAdminMailID'. But whr did you use it! Kindly suggest any script is there to specify From address in scripting?

          • Hi Sankaran,

            // Email: Organizer party - mandatory

            if (! emailActivityInstance.MessageFromParty.IsSet())


              emailAcitivtyTo.PartyKey.PartyID.content = "Sender Email as required";



            Hope this should work



  • Hi,

    How to attach, html tags in message content. I planned to send attractive mail to the user. That's why I tried with HTML tags. I have normally typed html tags within double codes in msg content variable. But it will print as it is, in email . Anyone help me to send an email with HTML tags. Thanks!

  • Hi,

    I have added the above script in the 'BeforeSave' of a custom BO, which has a web service.  When I call this web service, I expected the script will send an email.  However, I am getting this error in Dump Analysis:

    08:29:29 _1000015 No access possible via a 'NULL' data reference. Y00RKLIIY_ /Y00RKLIIY_MAIN/SRC/ErrorHandlingBO-Root-Event-BeforeSave.absl 63 40

    Line no. where the above error is occurring is at:


    When calling the web service itself, it throws the below error:


                <env:Text xml:lang="en">RABAX occurred on server side</env:Text>



                <sap:Rabax xmlns:sap="">






    Can you please advise what I am doing wrong here, I have copy/pasted the above code?

    Thanks in advance,


  • Hi All,

    Since the EmailActivity is now deprecated, I am trying to make use of Activity BO to perform send mail, but could not achieve the same. i have these points unanswered:

    1. Without creating instance in Activity can I send the mail when Outlook is not configured?
    2. In Activity BO, Party.EmailURI is read only what can be done to specify the sender?

    Please guide.





      Yes this guide is now deprecated, however using the Platinum Engineering seems to be a new function and looks pretty straight forward for me, I haven't yet used it, but as soon as I do I'll update it here.

      I'm attaching a screenshot of the function itself: