Member since
12-09-2019
7
Posts
0
Kudos Received
0
Solutions
09-15-2022
05:17 AM
We can't use PutEmail processor direct for attachment. We can use FetchFile processor and direct to PutEmail processor to send attachment, but it fetchFile will send the attachment for the first trigger only. Alternatively for send attachment, you can use ExecuteScript Processor using python module and pass the argument parameter of mailto and fromto to script. import smtplib from email.mime.base import MIMEBase from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email import encoders fromaddr = 'SENDER@EMAIL.COM' #$arg1 Argument from NIFI Flow toaddr = 'RECIPIENT@EMAIL.COM' #$arg2 Argument from NIFI Flow msg = MIMEMultipart() msg['From'] = fromaddr msg['To'] = toaddr msg['Subject'] = 'Define the Subject' body = 'Define Body' msg.attach(MIMEText(body)) files = ['/user/path/filename1', '/user/path/filename2'] for filename in files: attachment = open(filename, 'rb') part = MIMEBase("application", "octet-stream") part.set_payload(attachment.read()) encoders.encode_base64(part) part.add_header("Content-Disposition", f"attachment; filename= {filename}") msg.attach(part) msg = msg.as_string() try: server = smtplib.SMTP('smtp.email.com:21') server.ehlo() server.starttls() server.login(fromaddr, 'user') server.sendmail(fromaddr, toaddr, msg) server.quit() @leandrolinof wrote: @Aaki_08 good morning. I have a situation where I need to email buyers of a certain ID with a certain PDF attachment. This attachment will be saved in a field in a table in oracle. Today I'm already using PutEmail to send the E-mail, but I don't know how to send the attachment. Could you help me, please? @leandrolinof wrote: @Aaki_08 good morning. I have a situation where I need to email buyers of a certain ID with a certain PDF attachment. This attachment will be saved in a field in a table in oracle. Today I'm already using PutEmail to send the E-mail, but I don't know how to send the attachment. Could you help me, please?
... View more
02-11-2021
10:00 PM
@Shu_ashu How to configure the flow if EvaluateJsonPath Processor flow have recipient mail id and FetchFile has the file path. I have configured as below but two mails are getting triggered. Could you help to modify the flow so that only one mail with attachment will trigger ?
... View more
12-13-2020
10:05 PM
Yes, That's correct Answer and it works. But do we have any other workaround, as we have disabled exec due to security reasons. So how to achieve this.?
... View more
12-09-2019
12:58 PM
@Aaki_08 You may want to try executing following commands: 1. On the Ambari server host: ambari-server stop 2. On all hosts ambari-agent stop 3. On Ambari server host: ambari-server uninstall-mpack --mpack-name=hdf-ambari-mpack --verbose Hope this helps you, Matt
... View more