Changeset View
Changeset View
Standalone View
Standalone View
test-wallace.py
Show All 25 Lines | |||||
sys.path.extend(['.', '..']) | sys.path.extend(['.', '..']) | ||||
from email.MIMEMultipart import MIMEMultipart | from email.MIMEMultipart import MIMEMultipart | ||||
from email.MIMEBase import MIMEBase | from email.MIMEBase import MIMEBase | ||||
from email.MIMEText import MIMEText | from email.MIMEText import MIMEText | ||||
from email.Utils import COMMASPACE, formatdate | from email.Utils import COMMASPACE, formatdate | ||||
from email import Encoders | from email import Encoders | ||||
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 | ||||
Show All 10 Lines | """ | ||||
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) ) | ||||
#msg.attach( MIMEBase('application', open('/boot/initrd-plymouth.img').read()) ) | # msg.attach( MIMEBase('application', open('/boot/initrd-plymouth.img').read()) ) | ||||
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 = [ | ||||
#'Jeroen van Meeuwen <jeroen.vanmeeuwen@klab.cc>', | #'Jeroen van Meeuwen <jeroen.vanmeeuwen@klab.cc>', | ||||
#'Aleksander Machniak <aleksander.machniak@klab.cc>', | #'Aleksander Machniak <aleksander.machniak@klab.cc>', | ||||
#'Georg Greve <georg.greve@klab.cc>', | #'Georg Greve <georg.greve@klab.cc>', | ||||
Show All 34 Lines |