Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DIRECTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,8 @@
* [Tabu Search](searches/tabu_search.py)
* [Ternary Search](searches/ternary_search.py)

## [Send Email](/send_email.py)

## Sorts
* [Bead Sort](sorts/bead_sort.py)
* [Binary Insertion Sort](sorts/binary_insertion_sort.py)
Expand Down
28 changes: 28 additions & 0 deletions send_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import smtplib
import ssl
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

try:
email = "<< Enter your email >>"
password = "<< Enter your password"

Check failure on line 8 in send_email.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (S105)

send_email.py:8:16: S105 Possible hardcoded password assigned to: "password"
to = "<< Enter sender email >>"
msg = """ << Email Body >>"""
message = MIMEMultipart()
message["From"] = email
message["To"] = to
message["Subject"] = "HacktoberFest 2019"
message.attach(MIMEText(msg, "plain"))
context = ssl.create_default_context()
server = smtplib.SMTP("smtp.gmail.com")
server.starttls()
server.ehlo()
server.login(email, password)
server.sendmail(email, to, message.as_string())
print('Email have been successfully send')

except Exception as ex:

Check failure on line 24 in send_email.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (BLE001)

send_email.py:24:8: BLE001 Do not catch blind exception: `Exception`
print(ex)

finally:
server.quit()
Loading