我有一个包含信息的输入框。
debnmr_tekst=StringVar()
debnmr=Entry(f2,bd=3,textvariable=debnmr_tekst)
debnmr.place(relx=0.5, rely=0.5, anchor=CENTER)
我喜欢将这些信息放在借方后面:在味精变量中。
尝试使用 get(( 函数,但我收到错误。希望你们能帮助我!:)
def mail_2():
username = "****@gmail.com"
password = ("*********")
recipient = "********@hotmail.com"
msg = ("""subject: Zending is afgehaald!
Onderstaande zending is afgehaald.
Debiteur:debnmr_tekst.get()
Klant:
Aantal pallets:
Totaal gewicht:
PB nummers:
*Dit bericht is automatisch gegenereerd
""")
server = smtplib.SMTP("smtp.gmail.com",587)
server.starttls()
server.login(username, password)
server.sendmail(username,recipient, msg)
server.quit()
您需要使用字符串格式将变量包含在字符串中。
msg = ("""subject: Zending is afgehaald!
Onderstaande zending is afgehaald.
Debiteur:{}
Klant:
Aantal pallets:
Totaal gewicht:
PB nummers:
*Dit bericht is automatisch gegenereerd
""")
msg = msg.format(debnmr_tekst.get())