Last active
March 30, 2024 01:08
-
-
Save thuwarakeshm/00f16f8eb2297ee0bf2efb30483627d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
def send_email(email="[email protected]"): | |
# All your email sending logics goes here | |
print(f"Sending email...: to {email}") | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser() | |
parser.add_argument("-e", "--email", help="Email to send") | |
args = parser.parse_args() | |
if args.email: | |
send_email(args.email) | |
else: | |
send_email() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from schedule import repeat, every, run_pending | |
@repeat(every(10).seconds) | |
@repeat(every(5).seconds) | |
def send_email(): | |
# All your email sending logics goes here | |
print("Sending email...") | |
while True: | |
run_pending() | |
time.sleep(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@repeat(every(10).seconds) | |
@repeat(every(5).seconds, email="[email protected]") | |
def send_email(email="[email protected]"): | |
# All your email sending logics goes here | |
print(f"Sending email...: to {email}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import schedule | |
def send_email(): | |
# All your email sending logics goes here | |
print("Sending email...") | |
schedule.every().day.at("14:45").do(send_email) | |
while True: | |
schedule.run_pending() | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment