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
02-11-2021
10:29 AM
My dataflow have recipient mail id for which the mail should be triggered with the attachment. As the recipient address is dynamic, the mail are getting triggered two times i) With the actual attachment & ii) with flow details attachment. I want to trigger mail once per flow with actual attachment. Guide me if anything wrong if the flow : How to get the local file attached to putEmail processor
... View more
Labels:
- Labels:
-
Apache Ambari
-
Apache MiNiFi
07-02-2020
06:03 AM
Check your /var mount in /etc/fstab, if it has noexec then /var has enough permissions. Try to remount giving the permission : #mount -o remount,defaults,nosuid,nodev,exec /var/
... View more
12-09-2019
03:45 AM
Post reinstalling HDF mpack getting below error : ERROR: Failed to execute after-install hook. Failed with error code after-install ERROR: Traceback (most recent call last): File "/var/lib/ambari-server/resources/mpacks/hdf-ambari-mpack-3.4.1.1-4/hooks/after_install.py", line 36, in <module> smartsense_versioner.fix_smartsense_versions() File "/var/lib/ambari-server/resources/mpacks/hdf-ambari-mpack-3.4.1.1-4/hooks/smartsense_versioner.py", line 58, in fix_smartsense_versions shell.checked_call(["cp", "-f", source_view_jar_file_path, new_view_jar_file_path], sudo=True) File "/usr/lib/ambari-server/lib/resource_management/core/shell.py", line 72, in inner result = function(command, **kwargs) File "/usr/lib/ambari-server/lib/resource_management/core/shell.py", line 102, in checked_call tries=tries, try_sleep=try_sleep, timeout_kill_strategy=timeout_kill_strategy, returns=returns) File "/usr/lib/ambari-server/lib/resource_management/core/shell.py", line 150, in _call_wrapper result = _call(command, **kwargs_copy) File "/usr/lib/ambari-server/lib/resource_management/core/shell.py", line 314, in _call raise ExecutionFailed(err_msg, code, out, err) resource_management.core.exceptions.ExecutionFailed: Execution of 'cp -f /var/lib/ambari-server/resources/stacks/HDF/3.2.b/services/SMARTSENSE/package/files/view/smartsense-ambari-view-2.7.4.jar /var/lib/ambari-server/resources/stacks/HDF/3.2.b/services/SMARTSENSE/package/files/view/smartsense-ambari-view-1.5.0.2.7.4.0-118.jar' returned 1. cp: cannot stat '/var/lib/ambari-server/resources/stacks/HDF/3.2.b/services/SMARTSENSE/package/files/view/smartsense-ambari-view-2.7.4.jar': No such file or directory ERROR: Exiting with exit code -1. REASON: Failed to execute after-install hook. Failed with error code after-install
... View more