Clarity

Expand all | Collapse all

Need help sending html email from gel script

  • 1.  Need help sending html email from gel script

    Posted Oct 12, 2010 07:06 AM
    The following is an excerpt from my gel script to send an html email:      Project General:-    Project Id: ${row[i+1]}  ...      This script is called from a process on the project object, and generates the following email:   From: clarity_support@hbo.com
    Sent: Wednesday, June 17, 2009 11:36 AM
    To: Picus, Sue (HBO-NS)
    Subject: Project Request Information: test sue11 (0010171) Project General:- Project Id: 0010171 Project Name: test sue11 Project Manager: Admin - Sue Test Project Manager Email: sue.picus@hbo.com Project Start: 2009-06-15 08:00:00.0 Project Finish: 2009-06-15 17:00:00.0  I tried inserting a HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> statement, but Clarity wouldn't let me save it, giving the error
    BPM-0703: Custom script syntax error at line 213, column 10: A DOCTYPE is not allowed in content.  I assume I'm missing the obvious tag to convert this into an html message?


  • 2.  Re: Need help sending html email from gel script

    Posted Oct 12, 2010 07:06 AM
    Gel script supports only plain text email's. If you want HTML mail notifications, call custom stored procedure(SMTP)  from gel script that sends formatted  mail notifications.    


  • 3.  Re: Need help sending html email from gel script

    Posted Oct 12, 2010 07:06 AM
    Thank you for your response. Just to be clear, I am not using this for notifications.  I have a gel script that queries the database on demand and sends email. Would that affect your response?


  • 4.  Re: Need help sending html email from gel script

    Posted Oct 12, 2010 07:06 AM
    Notification mean any formatted email that you want to send from GEL.


  • 5.  Re: Need help sending html email from gel script

    Posted Oct 12, 2010 07:07 AM
    Is  simple  table in a html file also treated as formatted html?


  • 6.  Re: Need help sending html email from gel script
    Best Answer

    Posted Oct 12, 2010 07:07 AM
    What I ended up doing as a workaround was calling a java class from the GEL script. Now all the GEL script does is retrieve parameters (such as process ID, ID of current  user logged in, etc.) and call the java class. Once we got the call to a java class to work, it was easy to query the database further and format the message the way we wanted.


  • 7.  Re: Need help sending html email from gel script

    Posted Oct 12, 2010 07:07 AM
    Using a java class - nice workaround, Congratulations.Which class?   Can you share a snippet for the thread?  Just for the record - it IS possible to send html email via GEL, but you do have to carry the generated html within CDATA.  


  • 8.  Re: Need help sending html email from gel script

    Posted Oct 12, 2010 07:07 AM
    ^ sorry to labour the point, but I am interpreting that statement as "it IS possible (etc)" by using methods OTHER than the out-of-the-box methods?  i.e. you can send HTML mail (using CDATA to hold the message) by sending to a different "mail method" then     Is that right?  (I tried a CDATA wrapped html message with and it formatted it OK, but it still sent it as plain text (so I received an email containing the html "plain text")  (If my terminology is a bit off; I'm a bit of a GEL (etc) noob so often I don't quite undertand what I'm talking about!   :-) )  Dave.


  • 9.  Re: Need help sending html email from gel script

    Posted Oct 12, 2010 07:07 AM
    I stand corrected (my apologies), it isn't gel itself that allows html email. Here are some pieces that should help.
     javax.mail










    and 'transport'







      You still do need to use CDATA to carry the html as previously posted.


  • 10.  RE: Re: Need help sending html email from gel script

    Posted Apr 21, 2011 04:26 PM
    Is it possible to invoke an exe from a GEL script. (This exe can be built in .Net)




    suep wrote:

    What I ended up doing as a workaround was calling a java class from the GEL script. Now all the GEL script does is retrieve parameters (such as process ID, ID of current  user logged in, etc.) and call the java class. Once we got the call to a java class to work, it was easy to query the database further and format the message the way we wanted.


  • 11.  Re: Need help sending html email from gel script

    Posted Oct 12, 2010 07:07 AM
    You should use CDATA to carry the HTML  
















    .s {


    height: 0;


    line-height: 1;


    position: relative;


    top: -0.6em;


    vertical-align: baseline;


    vertical-align: bottom;


    font-size: xx-small;

    }

    .b {


    font-weight: bold;

    }

    .r {


    color: rgb(255,0,0);

    }











    This is a test html email message sent from a GEL script


    This is RED


    This is some BOLD TEXT in a paragraph.


    Required styles (e.g. superscript ) can be declared in an embedded css stylesheet or embedded inline .


    You can also include data from the GEL script - e.g:








    Sender

    Mail Server

    Subject

    Send To





    ${Sender}

    ${MailServer}

    ${email_subject}



    ]]>




    ${thisRecipient.toString()}












    NB: It is important to enclose the html in a CDATA section to retain the spacing around words. Also, snippets of GEL/Jelly code should be outside the CDATA sections.











    ]]>


  • 12.  Re: Need help sending html email from gel script

    Posted Oct 12, 2010 07:07 AM
    Paul - just a question,  The response you recently posted concerning using CDATA / HTML message; this is still using the solution based on SP/SMTP like suggested by sivasairam?(i.e. I can't use this in a GEL email solution (GEL email is always plain text?)?)  Dave.


  • 13.  Re: Need help sending html email from gel script

    Posted Oct 12, 2010 07:07 AM
    Hi, PaulThanks for your reply. Will let you know once I customized the code for my requirement.


  • 14.  Re: Need help sending html email from gel script

    Posted Oct 12, 2010 07:07 AM
    How do you insert this in the email message.  === I included your gel:parse code here ===  
    ${htmlMessage}When I run this I get null document.