Quantcast
Channel: SCN : Unanswered Discussions - SAP Business ByDesign
Viewing all articles
Browse latest Browse all 4032

Issue with HTML emails

$
0
0

Hello dear ByDesign experts,

 

I followed the awesome blog from Alessandro http://scn.sap.com/community/business-bydesign/studio/blog/2013/12/12/html-custom-email-notifications-in-sap-cloud-applications-studio in order to send emails with a custom signature.

 

Mu business case it to extend the New Email functionality under Account Management → New Email by adding the signature of the corresponding user dynamically.

 

Here is the signature I need at the bottom of my email's body (two lines under the last word written by the user in the Notes):

 

                    EmployeeName +", "+ AcademicTitle +

                    EmployeeRole +

                    "Company Name"+

                    PhoneNumber+" Ext: "+PhoneExtension+

                    CellPhone+

                    "http://www.companyswebsite.ca"+

                    "Some french text"+

                    "Some english test";

 

I did succeed in creating an attachment in HTML as advised by Alessandro.

The problem is when I send then receive the email, the body.html is still in a attachment and not in the body of the message. The email seems to always be sent as a Plain text format and not in HTML format.

 

Issue email 1.jpg

I tried to add the HTML string directly in the Text Collection, but it does not work, the tags are just displayed as strings. So in the Notes (TextCollection) I do not succeed in doing line breaks, or putting a line in Italic, or even doing a ref to a website.

     - If someone knows how to customize the TextCollection.Text.TextContent with HTML tags or even CSS I am very interested in this.

 

I also tried to allow only text/html as Mime files in the corresponding Business Configuration activity and disabled Rich Text or Plain text. But this does not impact the email function I used as the email is still sent as a Plain text.

 

Here is my sample code in the EmailActivity.XBO→Before-Save:

if(!this.AttachmentFolder.IsSet()){    var instEmailAttFld;     instEmailAttFld = this.AttachmentFolder.Create();    //Add attachment1 (html body)    var elActivityAttachmDoc: elementsof instEmailAttFld.Document ;    var binaryObject : BinaryObject;        elActivityAttachmDoc.VisibleIndicator = true;      elActivityAttachmDoc.MIMECode = "text/html";      elActivityAttachmDoc.Name = "body.html";      elActivityAttachmDoc.AlternativeName = "body.html";      elActivityAttachmDoc.CategoryCode = "2";      elActivityAttachmDoc.TypeCode.content = "10001";      var NewDocumentText = instEmailAttFld.Document.Create(elActivityAttachmDoc);    binaryObject.content = Binary.ParseFromString("<html><body>testJAO<br/><br/>"+ EmployeeName +", "+ AcademicTitle +"<br/>"+EmployeeRole+"<br/>CompanyName<br/>"+PhoneNumber+" Ext: "+PhoneExtension+"<br/>"+CellPhone+"<br/><a href=www.company.ca>www.company.ca</a>"+"<br/><i>French Text<i/><br/><i>English Text<i/><body></html>");    if(NewDocumentText.IsSet()){        var filecontent : elementsof NewDocumentText.FileContent;        filecontent.BinaryObject.content = binaryObject.content;        NewDocumentText.FileContent.Create(filecontent);        var break = "test";        }
}

Normally, the code is not the issue as when I open the body.html in my web browser, I get the signature structure that I require.

 

But I am just not able to add this as a text in my email's body.

 

If someone has any clue on this, it would be very very very appreciated!

 

Thank you very much for your attention.

Best regards.

Jacques-Antoine Ollier


Viewing all articles
Browse latest Browse all 4032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>