HTML email text in workflow rules

SUGGESTED

Hi,

Need a small help, where's the how-to guide link: online-help.sageerpx3.com/.../RELNOTE_V12.0.33.htm

  • 0

    Hi Chunheng,

    I suggest creating a case with the support team to make an official request for this document to be released.

    Thanks  

  • 0
    SUGGESTED

    Hi,

    To do this, you need to use this entry point:

    SENDMES: Allows bypassing the system's email sending order The SENDMES entry point allows you to use an alternative email sending process instead of the "Send" (Client) or "meladx" (server) instruction. This enables you to encrypt the sent file or generate an HTML file, for example, to send images within the text or modify the text of signature tags.

    To activate an entry point, follow these steps:

    1. Go to the Development > Script Dictionary > Entry Points (GESAPE).
    2. Enter the standard script (e.g., AWRKMEL) and the specific script to which you will direct the entry points (e.g., ZPEAWRKMEL).
    3. In the specific script , you will be able to connect to the SENDMES entry point.
    To send workflows in HTML format, I use blat.exe instead of meladx (which, to my knowledge, doesn't support it). For this, you need to download blat.exe from here: https://sourceforge.net/projects/blat/files/

    And copy it to the "bin" directory of the runtime:

    Here is an example of code to generate HTML content and send it through a standard workflow rule:

    #Récupération des points d'entrée du traitement standard AWRKMEL
    $ACTION
        Case ACTION
            When "SENDMES"  : Gosub SENDMES
            When Default
        Endcase
    Return
    
    $SENDMES
      #code workflow (pour l'exemple j'ai créé un workflow de type entrée de fonction
      #attention pour le type manuel le standard ne place pas la table [AWA])
      If [F:AWA]CODE="TESTHTML"
        Local Integer I,J
        #écriture d'un fichier html
        FIC_MAIL = filpath("tmp","M"+NOMRET,"html",0)
        Openo FIC_MAIL,0 Using [MES]
        Wrseq '<html>' Using [MES]
        Wrseq '<head>' Using [MES]
        Wrseq '    <meta charset="UTF-8">' Using [MES]
        Wrseq '    <title>Email HTML</title>' Using [MES]
        Wrseq '</head>' Using [MES]
        Wrseq '<body>' Using [MES]
        Wrseq '    <table width="100%" cellpadding="0" cellspacing="0" border="0">' Using [MES]
        Wrseq '        <tr>' Using [MES]
        Wrseq '            <td align="center">' Using [MES]
        Wrseq '                <table width="600" cellpadding="0" cellspacing="0" border="0">' Using [MES]
        Wrseq '                    <tr>' Using [MES]
        Wrseq '                        <td>' Using [MES]
        Wrseq '                            <h1 style="color: red;"><b>Email HTML</b></h1>' Using [MES]
        Wrseq '                        </td>' Using [MES]
        Wrseq '                    </tr>' Using [MES]
        Wrseq '                    <tr>' Using [MES]
        Wrseq '                        <td>' Using [MES]
        Wrseq '                            <p style="color:green;">Bienvenue dans mon e-mail. Ceci est un exemple simple de mail HTML.</p>' Using [MES]
        Wrseq '                        </td>' Using [MES]
        Wrseq '                    </tr>' Using [MES]
        Wrseq '                    <tr>' Using [MES]
        Wrseq '                        <td>' Using [MES]
        Wrseq '                            <p><i>Vous pouvez ajouter du contenu supplémentaire ici.</i></p>' Using [MES]
        Wrseq '                        </td>' Using [MES]
        Wrseq '                    </tr>' Using [MES]
        Wrseq '                    <tr>' Using [MES]
        Wrseq '                        <td>' Using [MES]
        Wrseq '                            <p>Merci de nous avoir contacté.</p>' Using [MES]
        Wrseq '                            <p>Piotr de DevX3 Consulting' Using [MES]
        Wrseq '                            <br/>[email protected]</p>' Using [MES]
        Wrseq '                        </td>' Using [MES]
        Wrseq '                    </tr>' Using [MES]
        Wrseq '                </table>' Using [MES]
        Wrseq '            </td>' Using [MES]
        Wrseq '        </tr>' Using [MES]
        Wrseq '    </table>' Using [MES]
        Wrseq '</body>' Using [MES]
        Wrseq '</html>' Using [MES]
        Openo Using [MES]
    
        #utilisation de blat.exe à la place de meladx
        ORDSYS(1) = 'blat'
        ORDSYS(1) -= FIC_MAIL
    
        #Récupération du/des destinataire(s) principal(aux) du workflow
        J = 0
        For I=1 To USR_NB
         If USR_ENVOI(I)=2 & (NIV=0 or USRNIV(I)=NIV)
          J += 1
          If J=1
           ORDSYS(1) -= '-to '
          Else
           ORDSYS(1) += ','
          Endif
          ORDSYS(1) += ctrans(USR_EMAIL(I))
         Endif
        Next I
    
        #Récupération du/des destinataire(s) en copie
        J = 0
        For I=1 To USR_NB
         If USR_ENVOI(I)=3 & (NIV=0 or USRNIV(I)=NIV)
          J += 1
          If J=1
           ORDSYS(1) -= '-cc '
          Else
           ORDSYS(1) += ','
          Endif
          ORDSYS(1) += ctrans(USR_EMAIL(I))
         Endif
        Next I
    
        ORDSYS(1) -= '-f'-ctrans(EXP_MAIL)  #expéditeur
        ORDSYS(1) -= '-server'-GSERMES      #serveur messagerie
        ORDSYS(1) -= '-subject'-'"'+func AWRKMEL.OBJET(TEXOBJ)+'"' #objet du workflow
        ORDSYS(1) -= '-html'
    
        #ordre d'execution système
        Call SYSTEME(adxmac(0),ORDSYS,"",STAT) From ORDSYS
        GPE=1 #on empêche le standard d'executer meladx
      Endif
    Return
    

    P.S.: Starting from version 2022R2 [V12 patch 30], Sage X3 allows sending HTML emails as a standard feature.

    Best regards,
    Piotr