In the new 1502 release there will be a new way to send mail, that will enable you to change the sender address as you want!

The emails sent in this way will not be available in the activity->email workcenter, but you can always trace them using a custom development.

Step 1. Create the reuse function


You can always skip this step, even if this is not recommended.

2.PNG

1.PNG

Step 2. (ab)use the reuse function

3.PNG

4.PNG

/wp-content/uploads/2015/02/5_637274.jpg

The highlighted yellow part is mandatory.

The highlighted green part is our reuse function.

Happy mailing 🙂

To report this post you need to login first.

39 Comments

You must be Logged on to comment or reply to a post.

      1. Jacques-Antoine Ollier

        How did you find this new functionality dear Alessandro?

        I passed through the new user guide, nothing seems to mention it, neither in the “What’s new” document.

        How do you find all this tips and tricks? 🙂

        Thank you for your attention.

        Best regards.

        Jacques-Antoine

        (0) 
      1. Anthony K

        Hi Alessandro,

        What is “qryCatPhNot”? Could you please tell me which BO or context variable do you use? I can see from the code, it is returning the email template. Thanks a lot

        (0) 
  1. Anthony K

    Hi Alessandro,

    What is “qryCatPhNot_Result”? Could you please tell me which BO or context variable do you use? I can see from the code, it is returning the email template. Thanks a lot

    (0) 
      1. Anthony K

        Hi Alessandro, thanks for the info.

        And how do you create EmailTxt with placeholder &1?

        I am on 1505 but don’t see this new functionality in SDK guide. Is there a way to get the uploaded HTML file from Service -> Template? Thanks again

        (0) 
        1. Alessandro Iannacci Post author

          There is no standard way. If you want a template you need to create a BCO or a BO, storing your text (with placeholders) and implement a function (for example a reuse function) to get it back, replacing the placeholders.

          (0) 
  2. Elena Troanca

    Hi Alessandro,

    Thanks for your helpful info.

    Does this custom email functionality support also HTML format, e.g.:

    var lv_body : XPEString;

    lv_body = “<html><head><meta http-equiv=\”Content-Type\”     content=\”text/html; charset=utf-8\” /><title>Template</title></head><body><b>test</b></body></html>”;

    I guess if BodyIsHTML parameter is set as true,then we can insert HTML coding into the body content.

    e.g. SendEmail.SendEmailABSL(recepients, from, subject, body, Attachments, true);

    Thanks and regards,

    Elena

    (0) 
    1. Anthony K

      Hi Elena, HTML format is working. But when I ran a test, it is limited to 255 chars. I guess you just need to concatenate the XPE Strings. Let us know how you go.

      (0) 
  3. Christine Toblier

    Hi Alessandro, thank you for your blog post.

    This is very useful.

    Can I ask one more question:

    Can you tell me how i can add an attachment to the mail?

    I created a PDF out of a custom form.

    var docType : GlobalDataTypes:DocumentTypeCode;

    var FormTemplateLanguage = “DE”;

    var PDF : BinaryObject; >

    var FormTemplateCode : OutputRequestFormTemplateCode;

    FormTemplateCode.content = “Y3I06KDB_PB634”;

    //Code is Form Template Header Code

    PDF = OutputManagementUtilities.GetPDF(this, FormTemplateCode, FormTemplateLanguage);

    PDF.mimeCode = “application/pdf”

    The Data Type of this PDF is BinaryObject (BASIS.Global)

    The Function SendMail needs an AttachmentList of Type Attachment (AP.Platinum). Attachment.Binary is of Type Binary(AP.Platinum).

    Do you have an Idea how i can handle this data types and create an attachment out of my formular?

    (0) 
      1. Christine Toblier

        Hi Alessandro,

        thank you for your answer. I have already tried to to that.

        The problem is, that the function SendWithAttachment takes Attachments of type AP.PlatinumEngineering.Attachment. I don’t know how to create an attachment of this datatype.

        I can create a binary of tybe BASIS.Global.Binary.

        AP.PlatinumEngineering.Attachment, just takes binaries of type AP.PlatinumEngineering.Binary.

        I cannot assign the binary from one namespace to the binary form the other namespace.

        Do you know, where I can get more Information about that the PlatiniumEngineering Attachment and how i can create an attachment of that type?

        Kind regards,

        Christine Toblier

        (0) 
        1. Alessandro Iannacci Post author

          Hi Christine,

          in the following example I tried to assign a binary of type BASIS.Global.Binary (atta) to the binary of type AP.PlatinumEngineering.Attachment (atta3)

          xscn2.JPG

          (0) 
          1. Christine Toblier

            I tried that too, but then my Email had no attachment at all. So I thought, that it is of that mismatch. Have you tried to generate an email with that code?

            (0) 
          2. SARUCHI PATHELA

            Hi Alessandro Iannacci

            I have an attachment created in my custom BO BO_ticket which is of type Binary but now I have created an extension object for service ticket where I have an action Send Email in which I need to read that attachment from my custom BO and then I need to send the same attachment in the email. For send email I am using above blog approach where attachment will be Platinum Engineering attachment

            // create PDF

            var FormTemplateLanguage = “E”;

            var FormTemplateCode : OutputRequestFormTemplateCode;

            FormTemplateCode.content = “YE2P6WJ7_PVIQD”;

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

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

                Trace.Info(“document successfully created”);

              Attachment.Binary=pdfDocument.content;

              Attachment.FileName=”hello.pdf”;

              Attachments.Add(Attachment);

            }

            So here I am not able to read my custom attachment correctly and supply it correctly to

            Attachments.Add(——–)


            Can you please help me on how to read this attachment correctly


            Thanks

            Saruchi

            (0) 
  4. Stefan Kiefer

    Hi,

    I am writing here as the Author of this function. I got to know this “HTML 255 chars damn thing” from Tom lennart and I plan to improve this in 1511 in the way that you do not need to care of breaks.

    One more thing to the users of the function: The Tenant URL has always to be inside the email otherwise the function will add it. This is to track from which tenant the email is sent from – not to cause SPAM.

    Cheers

    Stefan

    (0) 
      1. Fred K

        Hi Stefan,

        I can send the attached file with the following codes.

        Please correct me if there is anything strange in my codes.

        var FormTemplateLanguage = “E”;

        var FormTemplateCode : OutputRequestFormTemplateCode;

        FormTemplateCode.content = “TemplateHeaderCode“;

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

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

          att.Binary=pdfDocument.content;

          att.FileName=”hello.pdf”;

          atts.Add(att);

        }

        // function call

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

        Best Regards

        Fred

        (0) 
        1. Stefan Kiefer

          Hi Fred,

          You code looks fine.

          I would suggest you sent the email at first without the attachement – if this works – I would try to add the attachments. If the datatype of the attachment matches it should work.

          Best regards,

          Stefan

          (0) 
            1. SARUCHI PATHELA

              Hi Fred K

              so it was possible for you to send email with attachments using Reuse library. In my requirement also I need to send my custom form as attachments.

              Thanks

              Saruchi

              (0) 
                  1. Fred K

                    Hi Saruchi,

                    What kind of conversion do you mean?

                    I created attachment from PDF template.

                    Here is the complete code for your reference:

                    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

                    (0) 
                    1. SARUCHI PATHELA

                      Hi

                      This statement is failing in my scenario , though I am passing the correct FormTemplateCode and language as E

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

                      (0) 

Leave a Reply