# -*- coding: utf-8 -*- # from urllib.parse import urljoin from django.conf import settings from django.utils.translation import ugettext as _ from common.const.front_urls import TICKET_DETAIL from common.utils import get_logger from common.tasks import send_mail_async logger = get_logger(__name__) from tickets.models import Ticket def send_new_ticket_mail_to_assignees(ticket: Ticket, assignees): recipient_list = [user.email for user in assignees] user = ticket.user if not recipient_list: logger.error("Ticket not has assignees: {}".format(ticket.id)) return subject = '{}: {}'.format(_("New ticket"), ticket.title) # 这里要设置前端地址,因为要直接跳转到页面 detail_url = urljoin(settings.SITE_URL, TICKET_DETAIL.format(id=ticket.id)) message = _("""
Your has a new ticket
Your ticket has been replay