-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomation-SendEmail.yml
68 lines (67 loc) · 2.19 KB
/
automation-SendEmail.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
commonfields:
id: SendEmail
version: -1
name: SendEmail
script: |-
from string import Template
dArgs = demisto.args()
if 'htmlBody' in dArgs:
dArgs['htmlBody'] = Template(dArgs['htmlBody'].replace('\\n', '\n')).safe_substitute(recipient=dArgs['to'])
elif 'body' in dArgs:
dArgs['body'] = Template(dArgs['body'].replace('\\n', '\n')).safe_substitute(recipient=dArgs['to'])
elif 'noteEntryID' in dArgs:
entry = demisto.executeCommand( 'getEntry', { 'id' : demisto.args()['noteEntryID'] } )[0]
if isError(entry):
demisto.results(entry)
sys.exit()
else:
dArgs['body'] = entry['Contents']
else:
dArgs['body'] = ''
if 'subject' in dArgs:
if demisto.incidents():
dArgs['subject'] = Template(dArgs['subject']).safe_substitute(name=demisto.incidents()[0]['name'])
else:
dArgs['subject'] = 'No subject'
demisto.results(demisto.executeCommand('send-mail', dArgs))
type: python
tags:
- response
- email
- server
comment: |-
Deprecated - please use the send-mail command instead
Send an email with the specified parameters.
Attachments are provided as a comma-separated list of entry IDs.
Example usage: !SendEmail subject="File from war room" body="Please see the attached file. --DBot" [email protected] [email protected] attachIDs=89@3,46@3
system: true
args:
- name: to
required: true
default: true
description: Email addresses for the 'to' field
- name: cc
description: Email addresses for the 'cc' field
- name: bcc
description: Email addresses for the 'bcc' field
- name: subject
required: true
description: Subject for the email to be sent
- name: body
description: The contents (body) of the email to be sent
- name: attachIDs
description: 'A comma-separated list of IDs of war room entries that contain files.
Used to attach files to the outgoing email. Example: attachIDs=15@8,19@8'
- name: htmlBody
description: Send an html formatted email - overrides "body" argument, cannot use
both.
- name: noteEntryID
description: Send the textual contents of an entry
- name: replyTo
description: The address to reply to
scripttarget: 0
dependson:
must:
- send-mail
runonce: false
deprecated: true