def _send_offer_assignment_notification_email(config, user_email, subject, email_body, site_code, task):
try:<EOL><INDENT>sailthru_client = get_sailthru_client(site_code)<EOL><DEDENT>except SailthruError:<EOL><INDENT>logger.exception(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(message=email_body)<EOL>)<EOL>return None<EOL><DEDENT>email_vars = {<EOL>'<STR_LIT>': subject,<EOL>'<STR_LIT>': email_body,<EOL>}<EOL>try:<EOL><INDENT>response = sailthru_client.send(<EOL>template=config['<STR_LIT>']['<STR_LIT>'],<EOL>email=user_email,<EOL>_vars=email_vars<EOL>)<EOL><DEDENT>except SailthruClientError:<EOL><INDENT>logger.exception(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(message=email_body)<EOL>)<EOL>return None<EOL><DEDENT>if not response.is_ok():<EOL><INDENT>error = response.get_error()<EOL>logger.error(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(<EOL>message=email_body,<EOL>token_error_code=error.get_error_code(),<EOL>token_error_message=error.get_message()<EOL>)<EOL>)<EOL>if can_retry_sailthru_request(error):<EOL><INDENT>logger.info(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(message=email_body)<EOL>)<EOL>schedule_retry(task, config)<EOL><DEDENT>else:<EOL><INDENT>logger.warning(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(message=email_body)<EOL>)<EOL><DEDENT><DEDENT>return response<EOL>
Handles sending offer assignment notification emails and retrying failed emails when appropriate.