loginuser = '******' loginpass = '******' print('---->Delete x1,x2,xx3 if already existed...', end='') #delete x1,x2,xx3 if exists remote_operation('su - imail -c \ "account-delete [email protected];account-delete [email protected];account-delete [email protected]"' ,\ '10.49.58.239','root','letmein',1,'Mailbox Deleted Successfully',3) print('---->Create x1,x2,xx3 ... ', end='') #creaet account x1,x2,xx3 remote_operation('su - imail -c \ "account-create [email protected] p default;account-create [email protected] p default;account-create [email protected] p default"' ,\ '10.49.58.239','root','letmein',1,'MailboxId',3) #set account quota print("---->Set mailquotamaxmsgkb(mailquotatotkb) 0 ...", end='') remote_operation( 'su - imail -c "imdbcontrol sac x1 openwave.com mailquotamaxmsgkb 0;imdbcontrol sac x1 openwave.com mailquotatotkb 0"', '10.49.58.239', 'root', 'letmein', 0) #deliver 100 messages: for c in range(1, 101): print("Delivering message" + str(c)) send_mail(mtahost, mtaport, sender, ['x1 <*****@*****.**>']) time.sleep(10) # fetch 101 message body and firstlinedata imap_fetch(imaphost, imapport, mailboxname, loginuser, loginpass)
print ('---->Delete u1,u2,u3 if already existed...',end='') #delete u1,u2,u3 if exists remote_operation('su - imail -c \ "account-delete [email protected];account-delete [email protected];account-delete [email protected]"',\ '10.49.58.239','root','letmein',1,'Mailbox Deleted Successfully',3) print ('---->Create u1,u2,u3 ... ',end='') #creaet account u1,u2,u3 remote_operation('su - imail -c \ "account-create [email protected] p default;account-create [email protected] p default;account-create [email protected] p default"',\ '10.49.58.239','root','letmein',1,'MailboxId',3) print ('---->Clear mta.log firsltly ... ',end='') #clear mta.log firstly remote_operation('su - imail -c "> log/mta.log"','10.49.58.239','root','letmein',0) #set quote for sender and recepients #ssdsdsd print ('###############Beginning testing...######################') for tck ,tcv in sorted(testcases.items(),key=lambda testcases:testcases[0]): print ('\033[1;45mRunning testing testcase: '+tck+'---------->'+tcv['casename']+'\033[0m') sendnum = len(tcv['receivers']) #print ('recivers numbers are:'+str(sendnum)) print ('Sending message in proper formats ...',end='') send_mail(mtahost,mtaport,sender,tcv['receivers']) print ('Checking mta.log ... ',end='') remote_operation(tcv['commands'],sshtarget,sshaccount,sshpasswd,1,tcv['check_flags'],sendnum) print ('###############Endding testing...######################') print ('---->Delete u1,u2,u3 ...',end='') #delete u1,u2,u3 at last remote_operation('su - imail -c \ "account-delete [email protected];account-delete [email protected];account-delete [email protected]"',\ '10.49.58.239','root','letmein',1,'Mailbox Deleted Successfully',3)
#!/usr/bin/env python3 from modules.sendmails import send_mail recepients = ['xx1 <*****@*****.**>', 'xx3 <*****@*****.**>'] send_mail('10.49.58.239', 20025, '*****@*****.**', recepients)