Skip to content

Commit dfd2de9

Browse files
committed
Mailtrap backend: add set_tags
1 parent bac1399 commit dfd2de9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

anymail/backends/mailtrap.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import sys
2-
import warnings
32
from urllib.parse import quote
43

54
if sys.version_info < (3, 11):
65
from typing_extensions import Any, Dict, List, Literal, NotRequired, TypedDict
76
else:
87
from typing import Any, Dict, List, Literal, NotRequired, TypedDict
98

10-
from ..exceptions import AnymailRequestsAPIError, AnymailWarning
9+
from ..exceptions import AnymailRequestsAPIError
1110
from ..message import AnymailMessage, AnymailRecipientStatus
1211
from ..utils import Attachment, EmailAddress, get_anymail_setting, update_deep
1312
from .base_requests import AnymailRequestsBackend, RequestsPayload
@@ -139,6 +138,12 @@ def add_attachment(self, attachment: Attachment):
139138
att["content_id"] = attachment.cid
140139
self.data.setdefault("attachments", []).append(att)
141140

141+
def set_tags(self, tags: List[str]):
142+
if len(tags) > 1:
143+
self.unsupported_feature("multiple tags")
144+
if len(tags) > 0:
145+
self.data["category"] = tags[0]
146+
142147
def set_metadata(self, metadata):
143148
self.data.setdefault("custom_variables", {}).update(
144149
{str(k): str(v) for k, v in metadata.items()}

0 commit comments

Comments
 (0)