Update app.py
Browse files
app.py
CHANGED
@@ -31,6 +31,47 @@ from email.mime.text import MIMEText
|
|
31 |
|
32 |
st.title('Send Streamlit SMTP Email π π')
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
# -------------------------------------------------------------------------------------------------------------
|
35 |
|
36 |
import smtplib, ssl
|
|
|
31 |
|
32 |
st.title('Send Streamlit SMTP Email π π')
|
33 |
|
34 |
+
|
35 |
+
password = os.getenv("scitechtalk_gmail")
|
36 |
+
# password = "STT301256!"
|
37 |
+
st.write("password:", password)
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
# -------------------------------------------------------------------------------------------------------------
|
42 |
+
# POE WEB-SEARCH
|
43 |
+
# https://poe.com/s/DoBILpU4zpkFaMdOpMPH
|
44 |
+
|
45 |
+
import smtplib
|
46 |
+
from email.mime.text import MIMEText
|
47 |
+
|
48 |
+
def send_email(subject, body, sender, recipients, password):
|
49 |
+
msg = MIMEText(body)
|
50 |
+
msg['Subject'] = subject
|
51 |
+
msg['From'] = sender
|
52 |
+
msg['To'] = ', '.join(recipients)
|
53 |
+
|
54 |
+
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp_server:
|
55 |
+
smtp_server.login(sender, password)
|
56 |
+
smtp_server.sendmail(sender, recipients, msg.as_string())
|
57 |
+
|
58 |
+
print("Email sent successfully!")
|
59 |
+
|
60 |
+
# Set the email details
|
61 |
+
subject = "Test Email"
|
62 |
+
body = "This is a test email sent via Python"
|
63 |
+
sender = "[email protected]"
|
64 |
+
|
65 |
+
# recipients = ["[email protected]", "[email protected]"] # ORIGINAL
|
66 |
+
recipients = ["[email protected]"] # JB
|
67 |
+
|
68 |
+
# password = "your_password"
|
69 |
+
|
70 |
+
# Call the send_email function
|
71 |
+
send_email(subject, body, sender, recipients, password)
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
# -------------------------------------------------------------------------------------------------------------
|
76 |
|
77 |
import smtplib, ssl
|