Changeset View
Standalone View
test-wallace.py
Show All 19 Lines | |||||
import smtplib | import smtplib | ||||
import socket | import socket | ||||
import sys | import sys | ||||
# For development purposes | # For development purposes | ||||
sys.path.extend(['.', '..']) | sys.path.extend(['.', '..']) | ||||
from email.MIMEMultipart import MIMEMultipart | from email.MIMEMultipart import MIMEMultipart | ||||
Lint: PEP8 E402: module level import not at top of file | |||||
from email.MIMEBase import MIMEBase | from email.MIMEBase import MIMEBase | ||||
Lint: PEP8 E402 module level import not at top of file Lint: PEP8 E402: module level import not at top of file | |||||
from email.MIMEText import MIMEText | from email.MIMEText import MIMEText | ||||
Lint: PEP8 E402 module level import not at top of file Lint: PEP8 E402: module level import not at top of file | |||||
from email.Utils import COMMASPACE, formatdate | from email.Utils import COMMASPACE, formatdate | ||||
Lint: PEP8 E402 module level import not at top of file Lint: PEP8 E402: module level import not at top of file | |||||
from email import Encoders | from email import Encoders | ||||
Lint: PEP8 E402 module level import not at top of file Lint: PEP8 E402: module level import not at top of file | |||||
def send_mail(send_from, send_to, send_with=None): | def send_mail(send_from, send_to, send_with=None): | ||||
smtp = smtplib.SMTP("localhost", 10026) | smtp = smtplib.SMTP("localhost", 10026) | ||||
smtp.set_debuglevel(True) | smtp.set_debuglevel(True) | ||||
subject = "This is a Kolab load test mail" | subject = "This is a Kolab load test mail" | ||||
text = """Hi there, | text = """Hi there, | ||||
I am a Kolab Groupware test email, generated by a script that makes | I am a Kolab Groupware test email, generated by a script that makes | ||||
me send lots of email to lots of people using one account and a bunch | me send lots of email to lots of people using one account and a bunch | ||||
of delegation blah. | of delegation blah. | ||||
Your response, though completely unnecessary, would be appreciated, because | Your response, though completely unnecessary, would be appreciated, because | ||||
being a fictitious character doesn't do my address book of friends any good. | being a fictitious character doesn't do my address book of friends any good. | ||||
Kind regards, | Kind regards, | ||||
Lucy Meier. | Lucy Meier. | ||||
""" | """ | ||||
msg = MIMEMultipart() | msg = MIMEMultipart() | ||||
msg['From'] = send_from | msg['From'] = send_from | ||||
msg['To'] = COMMASPACE.join(send_to) | msg['To'] = COMMASPACE.join(send_to) | ||||
msg['Date'] = formatdate(localtime=True) | msg['Date'] = formatdate(localtime=True) | ||||
msg['Subject'] = subject | msg['Subject'] = subject | ||||
msg.attach( MIMEText(text) ) | msg.attach( MIMEText(text) ) | ||||
Lint: PEP8 E201 whitespace after '(' Lint: PEP8 E201: whitespace after '(' | |||||
Lint: PEP8 E202 whitespace before ')' Lint: PEP8 E202: whitespace before ')' | |||||
#msg.attach( MIMEBase('application', open('/boot/initrd-plymouth.img').read()) ) | # msg.attach( MIMEBase('application', open('/boot/initrd-plymouth.img').read()) ) | ||||
Lint: PEP8 E501 line too long (85 > 79 characters) Lint: PEP8 E501: line too long (85 > 79 characters) | |||||
smtp.sendmail(send_from, send_to, msg.as_string()) | smtp.sendmail(send_from, send_to, msg.as_string()) | ||||
if __name__ == "__main__": | if __name__ == "__main__": | ||||
#send_to = [ | #send_to = [ | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#'Jeroen van Meeuwen <jeroen.vanmeeuwen@klab.cc>', | #'Jeroen van Meeuwen <jeroen.vanmeeuwen@klab.cc>', | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#'Aleksander Machniak <aleksander.machniak@klab.cc>', | #'Aleksander Machniak <aleksander.machniak@klab.cc>', | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#'Georg Greve <georg.greve@klab.cc>', | #'Georg Greve <georg.greve@klab.cc>', | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#'Paul Adams <paul.adams@klab.cc>', | #'Paul Adams <paul.adams@klab.cc>', | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#'Thomas Broderli <thomas.broderli@klab.cc>', | #'Thomas Broderli <thomas.broderli@klab.cc>', | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#'Christoph Wickert <christoph.wickert@klab.cc>', | #'Christoph Wickert <christoph.wickert@klab.cc>', | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#'Lucy Meier <lucy.meier@klab.cc>', | #'Lucy Meier <lucy.meier@klab.cc>', | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#] | #] | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#send_mail( | #send_mail( | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
Lint: PEP8 E303 too many blank lines (2) Lint: PEP8 E303: too many blank lines (2) | |||||
#'Jeroen van Meeuwen <jeroen.vanmeeuwen@klab.cc>', | #'Jeroen van Meeuwen <jeroen.vanmeeuwen@klab.cc>', | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#send_to | #send_to | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#) | #) | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#send_mail( | #send_mail( | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#'Lucy Meier on behalf of Paul Adams <paul.adams@test90.kolabsys.com>', | #'Lucy Meier on behalf of Paul Adams <paul.adams@test90.kolabsys.com>', | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
Lint: PEP8 E501 line too long (83 > 79 characters) Lint: PEP8 E501: line too long (83 > 79 characters) | |||||
#send_to | #send_to | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#) | #) | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#send_mail( | #send_mail( | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#'Lucy Meier on behalf of Georg Greve <georg.greve@test90.kolabsys.com>', | #'Lucy Meier on behalf of Georg Greve <georg.greve@test90.kolabsys.com>', | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
Lint: PEP8 E501 line too long (85 > 79 characters) Lint: PEP8 E501: line too long (85 > 79 characters) | |||||
#send_to | #send_to | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
#) | #) | ||||
Lint: PEP8 E265 block comment should start with '# ' Lint: PEP8 E265: block comment should start with '# ' | |||||
send_to = [ | send_to = [ | ||||
'Jeroen van Meeuwen (REJECT) <vanmeeuwen+reject@kolabsys.com>', | 'Jeroen van Meeuwen (REJECT) <vanmeeuwen+reject@kolabsys.com>', | ||||
'Jeroen van Meeuwen (HOLD) <vanmeeuwen+hold@kolabsys.com>', | 'Jeroen van Meeuwen (HOLD) <vanmeeuwen+hold@kolabsys.com>', | ||||
'Jeroen van Meeuwen (DEFER) <vanmeeuwen+defer@kolabsys.com>', | 'Jeroen van Meeuwen (DEFER) <vanmeeuwen+defer@kolabsys.com>', | ||||
'Jeroen van Meeuwen (ACCEPT) <vanmeeuwen+accept@kolabsys.com>', | 'Jeroen van Meeuwen (ACCEPT) <vanmeeuwen+accept@kolabsys.com>', | ||||
'Jeroen "kanarip" van Meeuwen (ACCEPT) <kanarip+accept@kolabsys.com>', | 'Jeroen "kanarip" van Meeuwen (ACCEPT) <kanarip+accept@kolabsys.com>', | ||||
Lint: PEP8 E501 line too long (82 > 79 characters) Lint: PEP8 E501: line too long (82 > 79 characters) | |||||
'Jeroen "kanarip" van Meeuwen (REJECT) <kanarip+reject@kolabsys.com>', | 'Jeroen "kanarip" van Meeuwen (REJECT) <kanarip+reject@kolabsys.com>', | ||||
Lint: PEP8 E501 line too long (82 > 79 characters) Lint: PEP8 E501: line too long (82 > 79 characters) | |||||
'Lucy Meier (REJECT) <meier+reject@kolabsys.com>', | 'Lucy Meier (REJECT) <meier+reject@kolabsys.com>', | ||||
'Georg Greve (REJECT) <greve+reject@kolabsys.com>', | 'Georg Greve (REJECT) <greve+reject@kolabsys.com>', | ||||
] | ] | ||||
send_mail('Jeroen van Meeuwen <vanmeeuwen@kolabsys.com>', send_to) | send_mail('Jeroen van Meeuwen <vanmeeuwen@kolabsys.com>', send_to) |
module level import not at top of file