Question

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.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top