06-21-2021 01:55 PM
06-22-2021 09:12 AM
The File is put to the location configured with the variable “FilePath”. Per default it is /tmp.
Have a look to the workflow Variables.
06-22-2021 08:44 AM
Hi,
In the extreme git there are some workflows, like the Aggregate report Alarm History, were you generate for example a csv file, and then in mail activity you send the mail with the csv file in attached.
What I don’t understand is who to put the csv file in the mail activity.
Regards,
José Chaves
06-21-2021 04:56 PM
Hello Jose,
as far as I know that’s not possible with onboard resources but you can use tools from python. Here is a working example with smtplib:
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders
import os.path
email = 'sender@domain.com'
send_to_email = 'receiver1@domain.com,receiver1@domain.com'
subject = 'My message'
message = 'My text'
file_location = '/var/log/myAttachment.txt'
msg = MIMEMultipart()
msg['From'] = email
msg['To'] = send_to_email
msg['Subject'] = subject
msg.attach(MIMEText(message, 'plain'))
# Setup the attachment
filename = os.path.basename(file_location)
attachment = open(file_location, "rb")
part = MIMEBase('application', 'octet-stream')
part.set_payload(attachment.read())
encoders.encode_base64(part)
part.add_header('Content-Disposition', "attachment; filename= %s" % filename)
# Attach the attachment to the MIMEMultipart object
msg.attach(part)
server = smtplib.SMTP('1.1.1.1',25)
text = msg.as_string()
server.sendmail(email, send_to_email.split(','), text)
server.quit()