i am trying to send an email by using StreamSets.
for this, i am using Directory as Source(list of receipts in the text file) and
Jython Evaluator for Processing and trash for Destination(for testing only).
when i run pipeline, running without any error. but getting error mail to my sender_email like this:
Your message wasn't delivered to com.streamsets.pipeline.stage.processor.scripting.ScriptRecord@3ea57368 because the domain 3ea57368 couldn't be found. Check for typos or unnecessary spaces and try again.
Here is my sample code:
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import logging
for record in records:
try:
msg = MIMEMultipart()
msg['Subject'] = 'simple email in python'
message = 'here is the email'
msg.attach(MIMEText(message))
mailserver = smtplib.SMTP('smtp.gmail.com',587)
mailserver.ehlo()
mailserver.starttls()
mailserver.ehlo()
mailserver.login('sateesh.karuturi9@gmail.com', 'password')
mailserver.sendmail('sateesh.karuturi9@gmail.com',record,msg.as_string())
output.write(record)
mailserver.quit()
except Exception as e:
error.write(record, str(e))