def send_email(s, lst, *args): # lst is one User with all the information # not a list of multiple users # compose.php?mailbox=INBOX&startMessage=1 otvaranje sablona za pisanje global r global url print(lst) # recipient = '*****@*****.**' recipient = lst[0] subject = 'Zaduzenje' body = "Poštovana/Poštovani,\n\n" \ "Ovo je automatska poruka koja Vas obaveštava da ste se zadužili za knjigu " \ ""+lst[1]+": '"+lst[2]+"', signatura: "+str(lst[3])+".\n" \ "Datum uzimanja: "+lst[4]+"\nRok za vraćanje: "+lst[5]+"\n\n" \ "S poštovanjem,\nMilan Todorović\n\nBiblioteka Katedre za germanistiku\nFilološki fakultet\n" \ "Univerzitet u Beogradu\nStudentski trg 3\nTel: 011/2021-698\nRadno vreme: 9.00-17.00" files = {"startMessage":(None, "1"), "session":(None, "1"), "passed_id":(None,""), "send_to":(None, recipient), "send_to_cc":(None, ""), "send_to_bcc":(None, ""), "subject":(None, subject), "mailprio":(None, "3"), "body":(None, body), "send":(None, "Send"), "attachfile":("",""), "MAX_FILE_SIZE":(None, "20971520"), "username":(None, "milan.todorovic"), "smaction":(None, ""), "mailbox":(None, "INBOX"), "composesession":(None, "1"), "querystring":(None, "mailbox=INBOX&startMessage=1")} left_side = url+'left_main.php' right_side = url+'right_main.php' l = s.get(left_side) r = s.get(right_side) print('Loading left frame: ',l.status_code) print('Loading right frame: ',r.status_code) # time.sleep(1) compose = url + 'compose.php?mailbox=INBOX&startMessage=1' r = s.get(compose) print('Enterying "Compose": ',r.status_code) send = url+'compose.php' # time.sleep(5) # r = s.post(send, files=files, allow_redirects=False) doesnt work for soem reason r = s.post(send, files=files, allow_redirects=True) print('Mail sent: ',r.status_code) if int(r.status_code) == 200: DataBase.delete_lendBookEmails(lst[3]) # print('Redirecting to: ',r.headers['Location']) # r = s.get(r.headers['Location']) # print('Redirected to home page: ',r.status_code) print('User successfully notified about taken book.') del r del send del compose return 0