I am trying to send emails via mandrill inside push taskqueue. On the first attempt of the task, the email is sent, urlfetch.fetch results is 200 but task fails and is queued for the second attempt. On second attempt, mail is re-sent and task completes with a 200 status. Here is code snippet

try:
    result = urlfetch.fetch(url=<MANDRILL_SEND_URL>,
                            method=urlfetch.POST,
                            deadline=60,
                            payload=json.dumps(mail_params))
    if result.status_code == 200:
        # return 200 response (using flask with GAE)
        return "", 200  
except Exception as e:
        logging.error("100 - Exception while sending email: {0}".format(e))

Email is critical to flow, so I need to make sure email is sent so re-tries of tasks are needed.

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top