diff --git a/test-wallace.py b/test-wallace.py index 92d69f4..630711c 100755 --- a/test-wallace.py +++ b/test-wallace.py @@ -1,103 +1,102 @@ #!/usr/bin/python # # Copyright 2010-2013 Kolab Systems AG (http://www.kolabsys.com) # # Jeroen van Meeuwen (Kolab Systems) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # import smtplib import socket import sys # For development purposes sys.path.extend(['.', '..']) -from email.MIMEMultipart import MIMEMultipart -from email.MIMEBase import MIMEBase -from email.MIMEText import MIMEText -from email.Utils import COMMASPACE, formatdate -from email import Encoders +from email.mime.multipart import MIMEMultipart +from email.mime.base import MIMEBase +from email.mime.text import MIMEText +from email.utils import COMMASPACE, formatdate def send_mail(send_from, send_to, send_with=None): smtp = smtplib.SMTP("localhost", 10026) smtp.set_debuglevel(True) subject = "This is a Kolab load test mail" text = """Hi there, 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 of delegation blah. Your response, though completely unnecessary, would be appreciated, because being a fictitious character doesn't do my address book of friends any good. Kind regards, Lucy Meier. """ msg = MIMEMultipart() msg['From'] = send_from msg['To'] = COMMASPACE.join(send_to) msg['Date'] = formatdate(localtime=True) msg['Subject'] = subject msg.attach( MIMEText(text) ) # msg.attach( MIMEBase('application', open('/boot/initrd-plymouth.img').read()) ) smtp.sendmail(send_from, send_to, msg.as_string()) if __name__ == "__main__": #send_to = [ #'Jeroen van Meeuwen ', #'Aleksander Machniak ', #'Georg Greve ', #'Paul Adams ', #'Thomas Broderli ', #'Christoph Wickert ', #'Lucy Meier ', #] #send_mail( #'Jeroen van Meeuwen ', #send_to #) #send_mail( #'Lucy Meier on behalf of Paul Adams ', #send_to #) #send_mail( #'Lucy Meier on behalf of Georg Greve ', #send_to #) send_to = [ 'Jeroen van Meeuwen (REJECT) ', 'Jeroen van Meeuwen (HOLD) ', 'Jeroen van Meeuwen (DEFER) ', 'Jeroen van Meeuwen (ACCEPT) ', 'Jeroen "kanarip" van Meeuwen (ACCEPT) ', 'Jeroen "kanarip" van Meeuwen (REJECT) ', 'Lucy Meier (REJECT) ', 'Georg Greve (REJECT) ', ] send_mail('Jeroen van Meeuwen ', send_to)