DryDumbHead/easyHtmlEmail
A helper class that builds HTML emails in ABAP from an HTML template uploaded through SMW0, with placeholders replaced at runtime, so only the dynamic values are handled in code.
Building an HTML email by hand in ABAP means assembling markup through text elements or a message class, which even for plain text results in code the maintainer calls dirty, and worse for a modern HTML email with CSS and images. Zcl_easy_email instead consumes an HTML template uploaded through transaction SMW0, with placeholders the developer replaces at runtime, so only the dynamic part is handled in ABAP code. It is built on top of the function module WWW_HTML_MERGER and inherits its limitations, among them a 255-character line limit in the template.
Facts
Where it sits
Who is behind it
In the atlas: maintains 1, contributes to 1@DryDumbHeadmaintainer
Before choosing this
Signals
ActivityQuietNo published releases; repository quiet for 52 months
It publishes no releases, and its repository has been quiet for at least 24 full months. This may be normal for stable software; check whether its current state still fits your use.
Conditions
PracticalFunctional boundary
On an SAP S/4HANA system the maintainer points elsewhere: the README calls this solution helpful for non-S/4 systems and names SAP's own e-mail templates with CDS views as what S/4 systems have instead.
What it declares
Every artifact
- Type
- Package
- Origin
- Independently maintained
As a package
- Where it runs
- Inside its host
- Distributed through
- does not say
Connections
Telling a person something happened when they are not looking
Download
README
quoted from DryDumbHead/easyHtmlEmail under MIT, readeasyHtmlEmail
Easy to Genrate & Maintain Email in SAP (ABAP + HTML/CSS)
Generating & Maintaing E-mail through ABAP is always dirty code while buildling email body with text-elements/message class.
Even simple plain text Email results in lots of irrelevant code in ABAP, so generating modern e-mails (HTML/CSS/images) in abap can be a nightmare for anyone.
easyHtmlEmail provides a helper class Zcl_easy_email which helps the ABAP developer to consume HTML template to build email.
The static part of email will no longer be handled by ABAP code, developer only need to worry about dynamic values in email.
easyHtmlEmail Blog Post
Note:
Zcl_easy_emailis Built on Top of Function ModuleWWW_HTML_MERGER, so Pros & Cons are inherited. Refer WWW_HTML_MERGER
Features:
- Build Modern e-mails
- Static & dynamic content segregation
- Pesentation & logic segregation
- Avoid irrelevent ABAP code resulting clean code.
- Easy maintainace & translation of emails
- Resueability
- Easy Combining of master & child email templates
Changes:
Steps:
- Build email Template and upload in T-code
SMW0.

Template must contain Placeholders for dynamic values (highlighted in yellow are placeholders).

Demo HTML templates is taken from BBBootstrap public e-mail templates
-
Maintain config in Table
ZMAIL_TEMP_CONF.(Optional) -
Create instance of
Zcl_easy_emailand set template.DATA : go_EASY_EMAIL TYPE REF TO ZCL_EASY_EMAIL. CREATE OBJECT go_EASY_EMAIL . go_EASY_EMAIL->set_subject( title = 'mail subject ' ). go_EASY_EMAIL->set_template( p_template = 'ZTESTEMAIL' p_mastertemplate = 'ZTESTEMAILMASTER' ). -
Pass in Placeholder & dynamic value pairs.
go_EASY_EMAIL->replace_placeholder( EXPORTING placeholder_name = '!VBELN!' replacement_type = 'R' "replace placeholder with single value single_value = ' 23412 ' ). go_EASY_EMAIL->replace_placeholder( EXPORTING placeholder_name = '!PRICE!' replacement_type = 'R' "replace placeholder with single value single_value = ' 1234.90 ). data : multi_line TYPE soli_tab, line TYPE soli. line = 'LINE 1 : LINE1 </br>'. APPEND LINE to multi_line. line = 'LINE 2 : LINE2 </br>'. APPEND LINE to multi_line. go_EASY_EMAIL->replace_placeholder( EXPORTING placeholder_name = '!LOG!' replacement_type = ' ' "replace placeholder with multiple Lines multi_line = multi_line ). -
Build email , add recipients, send the mail
go_EASY_EMAIL->add_email( email = p_email ). go_EASY_EMAIL->build_body( ). go_EASY_EMAIL->send_mail( 'X' ). -
E-mail visible in SOST

Report
zeasy_email_demodemonstrate the usage of classZcl_easy_email.
Limitations:
- Number of Character in each line in HTML template <= 255
- Special care of text encoding required for HTML template. For BASIS 701 templates where stored in ISO-8859-2 encoding (code page 1401), so HTML template must be developed and maintained with ISO-8859-2 encoding. Incorrect encoding may result in unexpected results.
This solution is helpful for non-S/4 system
SAP has introduces much better solution E-MAIL templates + CDS view in S/4 systems more info.
License
History
Other 2
Notes
- Add attachments as text file, implicit conversion will be done when string is passed : method add_attachment
- Replace Placeholder by HTML <li> <option> <tr> when REPLACEMENT_TYPE is ' ' or 'T' : method Replace_placeholder
Others providing
Compare all 10 on the Notifications page →- aditheos/ApplicationLogsNotificationToFioriaditheos/ApplicationLogsNotificationToFioriRaises a Fiori launchpad notification when an application log records an error, and the notification opens the Application Logs app (F1487) on that log for review and corrective action.independent, abapFiori launchpad notification for application log errorsfrom ABAP
- agiguere/SCPmsPushNotificationREST_APIagiguere/SCPmsPushNotificationREST_APIABAP classes that send push notifications from an SAP backend to iOS devices through the REST API of SAP Cloud Platform Mobile Services, reached through an RFC destination on NetWeaver 731 or higher.independent, abapABAP classes sending push notifications to Mobile Servicesfrom ABAP
- ABAP-PRCABAP-PRCA framework for custom multi-step ABAP processes: a process class declares the states, and the framework runs each document through them and monitors the run.independent, abapFramework for multi-step ABAP processes with monitoringfrom ABAP
- com.sap.cds:cds-feature-notificationscom.sap.cds:cds-feature-notificationsSends business notifications from a CAP Java application through SAP Alert Notification service, delivered to SAP Build Work Zone or email, or logged to the console in local mode.sap official, capBusiness notifications from CAP Java via SAP Alert Notificationfrom CAP
- @cap-js/notifications@cap-js/notificationsPublishes business notifications to SAP Build WorkZone from the application, so a user is told something happened without the UI polling for it.sap official, capBusiness notifications from CAP to SAP Build WorkZonefrom CAP
- @cap-rp/notifications@cap-rp/notificationsA derived copy of the official notifications plugin under a different scope; its readme is @cap-js/notifications' with the name swapped.independent, capRenamed copy of @cap-js/notifications under another scopefrom CAP
- @expertum/cap-email-plugin@expertum/cap-email-pluginSends mail on entity lifecycle events from an annotation — @email.enabled on an entity, an HTML template with {{placeholder}} substitution, and a plugin-owned log entity recording what went out and what failed.independent, capAnnotation-driven mail on CAP entity lifecycle eventsfrom CAP
- @neoimpulse/cap-js-notifications@neoimpulse/cap-js-notificationsA copy of the official @cap-js/notifications plugin republished under another scope, whose README points at the original and says nothing about what was changed.independent, capCopy of @cap-js/notifications published under another scopefrom CAP
- peterlangner/zrsspeterlangner/zrssAn ABAP package that publishes content from an SAP NetWeaver ABAP system as an RSS feed for ABAP Development Tools and other RSS readers, stated for ABAP 7.00 and installed with abapGit.independent, abapRSS feed publisher for content from an SAP NetWeaver ABAP systemfrom ABAP
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
abaplint
Flavors
“Build email Template and upload in T-code `SMW0`.” — DryDumbHead/easyHtmlEmail — README, Steps
History in the atlas
- First seen.
For your agent
- Ref
artifact:drydumbhead-easyhtmlemail- JSON
- /artifacts/drydumbhead-easyhtmlemail.json
- MCP
- Connecting an agent