简体   繁体   English

使用流集发送电子邮件时出错

[英]Getting error while sending email by using Streamsets

i am trying to send an email by using StreamSets. 我试图通过使用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). 用于处理的Jython评估程序和用于目标的垃圾箱(仅用于测试)。

when i run pipeline, running without any error. 当我运行管道时,运行没有任何错误。 but getting error mail to my sender_email like this: 但是像这样将错误邮件发送到我的sender_email:

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))

Here is my error: 这是我的错误: 在此处输入图片说明

You're seeing this because you're using the record object as the email address - com.streamsets.pipeline.stage.processor.scripting.ScriptRecord@3ea57368 is the string value of a record instance. 您之所以会看到此信息,是因为您使用记录对象作为电子邮件地址com.streamsets.pipeline.stage.processor.scripting.ScriptRecord@3ea57368是记录实例的字符串值。

If you're using text data format in the Directory origin, then you can use record.value['text'] instead of record : 如果您在Directory原点中使用文本数据格式,则可以使用record.value['text']代替record

mailserver.sendmail('sateesh.karuturi9@gmail.com', record.value['text'], msg.as_string())

If you're using a different data format (delimited, JSON etc), use preview to figure out which field the email address is in, and reference it the same way. 如果您使用其他数据格式(定界,JSON等),请使用预览来确定电子邮件地址位于哪个字段,并以相同的方式引用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Python 发送 email 时出错 - Getting error while sending email using Python 通过SMTP发送电子邮件时出错 - Getting error while sending email through SMTP 使用 GmailD 发送 Email 时出错 - Error While Sending Email Using GmailD 使用codeigniter发送电子邮件时出错 - Error while sending an Email using codeigniter 出现致命错误:在PHP中使用Pear Mail发送电子邮件时,调用未定义的函数parseAddressList() - Getting Fatal error: Call to undefined function parseAddressList() while sending email using Pear Mail in PHP 为什么使用Zend Framework 1发送电子邮件时出现500 Internal Server Error? - Why I am getting 500 Internal Server Error while sending an email using Zend Framework 1? 在Laravel 5.4中发送电子邮件时出现``未定义的属性''错误 - Getting 'Undefined property' Error while sending email in Laravel 5.4 在php-codeigniter中发送电子邮件时出现未配置错误 - Getting not configured error while sending email in php-codeigniter 出现错误fsockopen():使用codeigniter电子邮件类发送电子邮件时,无法连接到smtp.googlemail.com:465(连接超时) - getting error fsockopen(): unable to connect to smtp.googlemail.com:465 (Connection timed out) while sending email using codeigniter email class 在Codeigniter中发送带有多个附件的电子邮件时出错 - getting error while sending email with multiple attachment in codeigniter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM