无法向python gae中的群组发送邮件

时间:2016-05-19 10:59:48

标签: python email google-app-engine

我想向群组发送邮件。但是Mail API没有发送到组ID。

这是我的代码

from google.appengine.api import mail
import traceback
class Mail:    
    # mail with html content    
    def send(self,emailFrom,emailTo,emailSubject,emailBody,emailHtml):
        try:
            logging.info("Mail From : " + emailFrom)
            message = mail.EmailMessage(sender=emailFrom,
                            subject=emailSubject)
            message.to = emailTo

            message.body = emailBody
            message.html = emailHtml
            result = message.send()
            logging.info("Mail Sent. To : " + emailTo + ' Subject : '+emailSubject)
            return "EmailSent"
        except Exception, err:
            logging.info("Unable to send email to " + emailTo + " : " + traceback.format_exc())
            return "ErrorInSendingEmail"

这未显示开发者控制台日志记录中的任何错误。

1 个答案:

答案 0 :(得分:0)

您是否可以将邮件发送给个人ID?如果是,如果该组是您的组织专用的内部组,您可能需要检查Google网上论坛设置,看看它是否有权接受来自外部邮件ID的邮件(邮件ID不以@yourorg结尾) .COM)