NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<gel:script xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:sql="jelly:sql" xmlns:util="jelly:util"
xmlns:xog="http://www.niku.com/xog"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bpm="jelly:com.niku.bpm.gel.BPMTagLibrary"
xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<!--
********************************************************************************
* Script Name: Invio Mail formattate in HTML
*
* Author: Alberto Colombo
*
* Environment: CA Clarity 15.2
*
* Description: Invia una mail in html usando le classi java presenti di default in clarity
*
* Notes: /
*
********************************************************************************
-->

<gel:setDataSource dbId="niku"/>
<!-- Ottengo tutti i parametri dal context -->
<core:invokeStatic className="com.niku.union.config.ConfigurationManager" method="getInstance" var="config"/>
<core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getEntryUrl()}" var="entryURL"/>
<core:set value="${entryURL}/niku/xog" var="XOGURL"/>
<core:set value="${config.getProperties().getMailServer().getHost()}" var="mailhost"/>
<core:set value="${config.getProperties().getMailServer().getDefaultSenderAddress()}" var="mail_from"/>
<gel:parameter var="clarityUser"/>
<gel:parameter var="claritypwd" secure="true"/>
<gel:log>Context. URL: ${entryURL}</gel:log>
<gel:log>Mail Server: ${mailhost}</gel:log>
<gel:log>Mail Mittente: ${mail_from}</gel:log>
<core:set var="dest" value=""/>

<sql:query escapeText="false" var="content">
select inv.ID, inv.NAME, a.name, a.gpa_mail, (select convert(varchar,r.MILESTONE_2,105))as date from RQP_RELEASES r
inner join INV_INVESTMENTS inv on inv.ID = r.INVESTMENT_ID
inner join (
select ii.ID, ii.name as projectName, serv.name, s.gpa_mail
from INV_INVESTMENTS ii
join ODF_CA_PROJECT prj on prj.id=ii.id
and ii.IS_ACTIVE=1 and ii.ODF_OBJECT_CODE ='project'
left outer join (select project.id, service.name
from odf_ca_project project
left outer join odf_ca_service s on project.gpa_sist_prim_im_evo= s.id
join inv_investments service on service.id = s.id)serv on serv.id = prj.id
join odf_ca_service s on prj.gpa_sist_prim_im_evo= s.id
) a on a.ID = inv.ID
where r.ID = ${gel_objectInstanceId}
</sql:query>

<core:forEach items="${content.rowsByIndex}" var="contentRow" indexVar="i">
<core:set value="${contentRow[0]}" var="projectID"/>
<core:set value="${contentRow[1]}" var="projectName"/>
<core:set value="${contentRow[2]}" var="serviceName"/>
<core:set value="${contentRow[3]}" var="emailTo"/>
<core:set value="${contentRow[4]}" var="dataColl"/>
</core:forEach>


<core:invokeStatic className="java.lang.Class" method="forName" var="recipientType">
<core:arg type="java.lang.String" value="javax.mail.Message$RecipientType" />
</core:invokeStatic>
<core:set value="${recipientType.getField('TO')}" var="recipientTypeTO" />
<core:set value="${recipientTypeTO.TO}" var="recipientTypeTO" />
<core:set value="${recipientType.getField('CC')}" var="recipientTypeCC" />
<core:set value="${recipientTypeCC.CC}" var="recipientTypeCC" />
<core:set value="${recipientType.getField('BCC')}" var="recipientTypeBCC" />
<core:set value="${recipientTypeBCC.BCC}" var="recipientTypeBCC" />
<core:new className="java.util.Properties" var="props" />
<core:set value="${props.put('mail.transport.protocol', 'smtp')}" var="void" />
<core:set value="${props.put('mail.smtp.host', mailhost)}" var="void" />
<core:set value="${props.put('mail.smtp.auth', 'true')}" var="void" />
<core:new className="com.niku.union.notification.MailAuthenticator" var="clarity_auth" />
<core:invokeStatic className="javax.mail.Session" method="getInstance" var="mailSession">
<core:arg type="java.util.Properties" value="${props}" />
<core:arg type="javax.mail.Authenticator" value="${clarity_auth}" />
</core:invokeStatic>
<core:set var="subject" value="Notifica avanzamento - ${projectName}" />
<!-- Messaggio in HTML, per inserire le variabili interrompere il cdata -->
<gel:parse var="htmlMessage">
<message>
<![CDATA[
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>Gentile Utente,</br>
l'applicazione <a href="]]>${entryURL}<![CDATA["style="text-decoration: underline;" target="_new"><i>Gestione Richieste ICT - CA PPM Clarity</i></a> ti informa che:</br></br> L'avanzamento ]]>${projectName}<![CDATA[ e' stato Rilasciato in Collaudo.</br>Data Rilascio in Collaudo:
]]>${dataColl}<![CDATA[</br> ]]><![CDATA[
<a href="]]>${entryURL}<![CDATA[/niku/nu#action:projmgr.projectProperties&id=]]>${projectID}<![CDATA[" style="text-decoration: underline;"><i>Clicca qui</i></a> per accedere all'avanzamento.
</br></br>
Questa e' una mail automatica, si prega di non rispondere direttamente

</body></html>

]]>
</message>
</gel:parse>
<gel:forEach select="$htmlMessage/message/node()" var="thisMessageNode">
<gel:set asString="true" select="$thisMessageNode" var="thisMessageNodeText" />
<core:set value="${thisMessageNodeText}" var="thisMessageText" />
</gel:forEach>
<!-- Mittente -->
<core:new className="javax.mail.internet.InternetAddress" var="sender">
<core:arg type="java.lang.String" value="${mail_from}" />
</core:new>
<!-- Destinatari (per inserirne più di uno separarli da una virgola -->
<core:new className="javax.mail.internet.InternetAddress" var="internetAddress"/>
<core:set value="${emailTo}" var="recipientsTO" />
<!-- Aggiungo persone in CC -->
<!--core:set value="[email protected]" var="recipientsCC" /-->
<core:new className="javax.mail.internet.MimeMultipart" var="multiPart" />
<core:new className="javax.mail.internet.MimeBodyPart" var="bodyPart" />
<core:set value="${bodyPart.setContent(thisMessageText, 'text/html')}" var="void" />
<core:set value="${multiPart.addBodyPart(bodyPart)}" var="void" />
<!-- Invio messaggio -->
<core:new className="javax.mail.internet.MimeMessage" var="message">
<core:arg type="javax.mail.Session" value="${mailSession}" />
</core:new>
<core:set value="${mailSession.setDebug(false)}" var="void" />
<core:set value="${message.setFrom(sender)}" var="void" />
<core:choose>
<core:when test="${recipientsTO.indexOf(',') > 0}">
<core:set value="${message.setRecipients(recipientTypeTO, internetAddress.parse(recipientsTO))}" var="void" />
</core:when>
<core:otherwise>
<core:new className="javax.mail.internet.InternetAddress" var="recipientsTO">
<core:arg type="java.lang.String" value="${recipientsTO}" />
</core:new>
<core:set value="${message.setRecipient(recipientTypeTO, recipientsTO)}" var="void" />
</core:otherwise>
</core:choose>

<core:set value="${message.setSubject(subject)}" var="void" />
<core:set value="${message.setContent(multiPart)}" var="void" />
<core:set value="${mailSession.getTransport()}" var="transport" />
<core:set value="${transport.connect()}" var="void" />
<core:switch on="${transport.isConnected()}">
<core:case value="${true}">
<core:set value="${transport.send(message)}" var="void" />
<core:set value="${transport.close()}" var="void" />
</core:case>
<core:default>
<core:new className="java.lang.Exception" var="exception">
<gel:log level="ERROR">"Cannot connect to mail server: ${mailhost}"</gel:log>
</core:new>
</core:default>
</core:switch>

</gel:script>
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.