Created 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
Created 03-30-2021 06:10 AM
The success relationship out of the ControlRate processor is why there are two emails. Only route success from ControlRate to the UpdateAttribute processor and there should only be a single email message.
Created 09-14-2022 06:21 AM
@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?
Created 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?