def mkWallet(): import passwordGen password = passwordGen.passGen() from blockchain import createwallet wallet = createwallet.create_wallet(password, 'cd6938f8-cd49-4aa0-a766-27c4b6d812c4', label = 'piggybank') global users users[wallet.identifier] = password file2 = open('stack.txt', 'w+') pickle.dump(users, file2) file2.close() return wallet.identifier
def alert(subject="Python Alert", message="An alert was generated by a python script."): conn = smtplib.SMTP("smtp.gmail.com", 587) conn.ehlo() conn.starttls() conn.login("*****@*****.**", passwordGen.passGen()) conn.sendmail("*****@*****.**", "*****@*****.**", f"Subject: {subject}\n\n" f"{message}") conn.quit()
def mkWallet(): import passwordGen password = passwordGen.passGen() from blockchain import createwallet wallet = createwallet.create_wallet(password, 'cd6938f8-cd49-4aa0-a766-27c4b6d812c4', label='piggybank') global users users[wallet.identifier] = password file2 = open('stack.txt', 'w+') pickle.dump(users, file2) file2.close() return wallet.identifier
import smtplib, passwordGen # SMTP object to connect to gmail mail server on port 587 conn = smtplib.SMTP("smtp.gmail.com", 587) # say hello to server conn.ehlo() # start enable TLS encryption conn.starttls() # grab my app password so I don't upload it to github password = passwordGen.passGen() conn.login("*****@*****.**", password) conn.sendmail("*****@*****.**", "*****@*****.**", "Subject: Python test email\n\n" "This is a test email.") conn.quit()
lastCol = ws.max_column latestMonth = ws.cell(row=1, column=lastCol).value # Check each member's payment status unpaidMembers = {} for r in range(2, ws.max_row + 1): payment = ws.cell(row=r, column=lastCol).value # find payment status of latest month if payment != "paid": # check payment status name = ws.cell(row=r, column=1).value # member name stored in first column email = ws.cell(row=r, column=2).value # member email stored in second column unpaidMembers[name] = email # Log into email account connSmtp = smtplib.SMTP("smtp.gmail.com", 587) connSmtp.ehlo() connSmtp.starttls() connSmtp.login("*****@*****.**", passwordGen.passGen()) # Send out reminder emails for name, email in unpaidMembers.items(): body = f"Subject: {latestMonth} dues unpaid.\n" \ f"Dear {name}:\n" \ f"Records show that you have not paid dues for {latestMonth}.\n" \ f"Please make this payment ASAP." print(f"Sending email to {email} ...") sendStatus = connSmtp.sendmail("*****@*****.**", email, body) if sendStatus != {}: print(f"There was a problem sending email to {email}: {sendStatus}") connSmtp.quit()