on 11-15-2021 4:29 AM
Hi All
I am facing an error "could not create an attachment" using the "Send Mail" operator in DI.
Attaching the flow for reference.
I am reading a csv file then converting the file object into a string to send it to python operator to construct the message attributes for "Send Mail" operator as below.
attr = dict()
attr["email.attachments"] = [input_csv_file_msg_string]
attr["email.subject"] = "Test"
attr["email.from"] = "alice@example.com"
attr["email.to"] = ["bob@example.com"]
msgbody = ("Test")
messageout = api.Message(body=msgbody, attributes=attr)
Could you please assist if there are any other attributes I need to construct before sending it to the "Send Email" operator ?
Thanks
Raghav
I was able to resolve the issue. The value to be sent to the attachment is only the name of the file and the file path needs to start with /vrep/<path>. So you cannot send the attachments on the fly. This needs to be a saved file object.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jyothi,
I am facing the same issue of 'can not create attachment, however, I have saved the file in system mgmt and consuming the same in python operator but it is still failing.
I have saved the output of message.error port of pipline operator into a file thru write file operator, the output of write file operator is given as an input to pyhton operator.
def on_input_er1(error):
attributes = {
"email.from": "ik@gmail.com",
"email.to": ["ik@abc.com"],
"email.subject": "Test mail from SAP DI",
"email.attachments": ["/files/vrep/exception.txt"]
};
send_body= "Dear User,\n\nException occured while loading data from DB to SRC HANA table:" + "\n\nError details are below:\n\n" + "Error Code["+str(Error_Code)+"] " + "Type of failure["+str(Error_Type)+"] failed at datetime["+date_time_str+"] " + "for the table["+str(t_name)+"]" + " and the graph name["+str(api.graph_name)+"]." + "\n\n" + "\n\n Thank you," + "\n SAP DI Team" + "\n\n" + " *** This is an automated e-mail. Please do not reply."
api.send("output", api.Message(attributes=attributes, body=send_body))
Can you plz advise?
Thanks,
Indu.
Hello Raghav,
Issue sorted, the change is basically at selecting the root dir in system mgmt.
/ instead of /files/
Thanks,
IK
Hi,
Can use Receive email operator to save attachment in DI data lake..?
Its output port say's as below
Any Work around...?
Not sure with help of Python we can read ‘plain-text’ format or ‘HTML’ format and get the attachment.
Thanks.
Deepak.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.