diff --git a/django/core/mail/message.py b/django/core/mail/message.py
index 656c41d63b..eba57cbf7b 100644
a
|
b
|
|
1 | 1 | import mimetypes |
2 | | |
| 2 | import imaplib, time |
3 | 3 | from email import ( |
4 | 4 | charset as Charset, encoders as Encoders, generator, message_from_string, |
5 | 5 | ) |
… |
… |
class EmailMessage:
|
397 | 397 | value = ', '.join(str(v) for v in values) |
398 | 398 | msg[header] = value |
399 | 399 | |
| 400 | def copy(self): |
| 401 | """ |
| 402 | makes a copy of the email in sender's sent folder |
| 403 | """ |
| 404 | message = str(self.message()) |
| 405 | imap = imaplib.IMAP4(settings.EMAIL_HOST) |
| 406 | imap.starttls() |
| 407 | imap.login(settings.EMAIL_HOST_USER, settings.EMAIL_HOST_PASSWORD) |
| 408 | imap.append('INBOX.Sent', '\\SEEN', imaplib.Time2Internaldate(time.time()), message.encode()) |
| 409 | imap.logout() |