简体   繁体   中英

not able to send mail to group in python gae

I want to send mail to the group. But Mail API is not sending to group id.

Here is my code

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"

this is not showing any error on developer console logging.

Are you able to send mails to individual ids? If yes and if the group is a internal group, which is exclusive to your organisation,you might want to check the google group settings and see if it has permissions to accept mails from external mail ids(mail ids which do not end with @yourorg.com)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM