v0.5.1
This commit is contained in:
@@ -13,4 +13,4 @@ cargo run -p stalwart-cli -- -u https://127.0.0.1:8080 -c admin:secret account c
|
||||
#cargo run -p stalwart-cli -- -u https://127.0.0.1:8080 -c admin:secret list add-members everyone jane john bill
|
||||
#cargo run -p stalwart-cli -- -u https://127.0.0.1:8080 -c admin:secret account list
|
||||
#cargo run -p stalwart-cli -- -u https://127.0.0.1:8080 -c admin:secret import messages --format mbox john _ignore/dovecot-crlf
|
||||
|
||||
#cargo run -p stalwart-cli -- -u https://127.0.0.1:8080 -c admin:secret import messages --format maildir john /var/mail/john
|
||||
|
||||
27
tests/resources/scripts/imap_import_single.py
Normal file
27
tests/resources/scripts/imap_import_single.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import imaplib
|
||||
import socket
|
||||
import time
|
||||
from email.message import Message
|
||||
from email.utils import formatdate
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
conn = imaplib.IMAP4('localhost')
|
||||
conn.login('john', '12345')
|
||||
conn.socket().setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||
current_date = datetime.now()
|
||||
timestamp = current_date.timestamp()
|
||||
|
||||
msg = Message()
|
||||
msg['From'] = 'somebody@some.where'
|
||||
msg['To'] = 'john@example.org'
|
||||
msg['Message-Id'] = f'unique.message.id.{current_date}@nowhere'
|
||||
msg['Date'] = formatdate(time.mktime(current_date.timetuple()), localtime=False, usegmt=True)
|
||||
msg['Subject'] = f"This is message #{timestamp}"
|
||||
msg.set_payload('...nothing...')
|
||||
|
||||
response_code, response_details = conn.append('INBOX', '', imaplib.Time2Internaldate(time.mktime(current_date.timetuple())), str(msg).encode('utf-8'))
|
||||
if response_code != 'OK':
|
||||
print(f'Error while appending message: {response_code} {response_details}')
|
||||
|
||||
print("Message appended.")
|
||||
conn.logout()
|
||||
Reference in New Issue
Block a user