Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P15864
generate_mbox.py
Active
Public
Actions
Authored by
Legoktm
on May 8 2021, 1:36 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F34445767: generate_mbox.py
May 8 2021, 1:36 AM
2021-05-08 01:36:25 (UTC+0)
Subscribers
None
#!/usr/bin/env python3
from
email.message
import
EmailMessage
import
mailbox
def
main
():
path
=
"/home/km/tmp/test.mbox"
mbox
=
mailbox
.
mbox
(
path
,
create
=
True
)
count
=
0
while
count
<
1000000
:
msg
=
EmailMessage
()
msg
[
'Subject'
]
=
f
"Test email #{count}"
msg
[
'From'
]
=
"test@example.org"
msg
[
"To"
]
=
"test5@polymorphic.lists.wmcloud.org"
msg
.
set_content
(
"blah blah blah "
*
100
)
mbox
.
add
(
msg
)
count
+=
1
mbox
.
close
()
if
__name__
==
"__main__"
:
main
()
Event Timeline
Legoktm
created this paste.
May 8 2021, 1:36 AM
2021-05-08 01:36:25 (UTC+0)
Log In to Comment