SendEmail Script Examples: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This page contains script examples for the [[Supported_QPR_ProcessAnalyzer_Commands_in_Scripts#--.23SendEmail|SendEmail]] script command.
This page contains script examples for the [[SQL Scripting Commands#--.23SendEmail|SendEmail]] script command.


The following example will send an e-mail message to multiple recipients.
The following example will send an e-mail message with two attachments to multiple recipients.
<pre>
<pre>
(SELECT 'EmailFrom', 'example.from@address.com') UNION ALL
(SELECT 'EmailFrom', 'example.from@address.com') UNION ALL
Line 7: Line 7:
(SELECT 'EmailSubject', 'Example E-mail') UNION ALL
(SELECT 'EmailSubject', 'Example E-mail') UNION ALL
(SELECT 'EmailBody', 'QPR ProcessAnalyzer example script started running.') UNION ALL
(SELECT 'EmailBody', 'QPR ProcessAnalyzer example script started running.') UNION ALL
(SELECT ''EmailAttachmentQuery', 'SELECT * from #EmailAttachmentParameters') UNION ALL
(SELECT 'SmtpServer', 'localhost')
(SELECT 'SmtpServer', 'localhost')
--#SendEmail
--#SendEmail
</pre>
</pre>


Where the #EmailAttachmentParameters table contains following data:
{| class="wikitable"
! style="text-align:left;"| Name
! style="text-align:left;"| Content
! style="text-align:left;"| Media type
! style="text-align:left;"| Creation time
|-
| Example attachment picture
| Picture.jpg
| image/jpg
| 2016-04-22 12:00:00
|-
| Example attachment xml file
| Example.xml
| text/xml
| 2016-04-22 12:00:01
|}
[[Category:Examples]]
[[Category:Examples]]

Latest revision as of 20:50, 25 October 2021

This page contains script examples for the SendEmail script command.

The following example will send an e-mail message with two attachments to multiple recipients.

(SELECT 'EmailFrom', 'example.from@address.com') UNION ALL
(SELECT 'EmailTo', 'recipient.one@address.com,recipient.two@address.com,recipient.three@address.com') UNION ALL
(SELECT 'EmailSubject', 'Example E-mail') UNION ALL
(SELECT 'EmailBody', 'QPR ProcessAnalyzer example script started running.') UNION ALL
(SELECT ''EmailAttachmentQuery', 'SELECT * from #EmailAttachmentParameters') UNION ALL
(SELECT 'SmtpServer', 'localhost')
--#SendEmail

Where the #EmailAttachmentParameters table contains following data:

Name Content Media type Creation time
Example attachment picture Picture.jpg image/jpg 2016-04-22 12:00:00
Example attachment xml file Example.xml text/xml 2016-04-22 12:00:01