66 lines
1.5 KiB
Python
66 lines
1.5 KiB
Python
import sys
|
|
from mailer import send_plain_email, send_html_email
|
|
|
|
|
|
def read_multiline(prompt: str) -> str:
|
|
print(prompt)
|
|
print("(finish with ';')")
|
|
|
|
lines = []
|
|
while True:
|
|
line = input()
|
|
if line == ';':
|
|
break
|
|
lines.append(line)
|
|
|
|
return '\n'.join(lines)
|
|
|
|
|
|
def send_text_flow():
|
|
to_addr = input("Receiver email: ").strip()
|
|
subject = input("Subject: ").strip() or "(No subject)"
|
|
body = read_multiline("Message:")
|
|
|
|
send_plain_email(to_addr, subject, body)
|
|
|
|
|
|
def send_html_flow():
|
|
to_addr = input("Receiver email: ").strip()
|
|
|
|
data = {
|
|
"company_name": "wstkeys",
|
|
"order_id": "123",
|
|
"customer_name": "4321",
|
|
"currency": "USD",
|
|
"items": [
|
|
{"name": "Game 1333", "quantity": 1, "price": 1330},
|
|
|
|
],
|
|
"date": "23.03.2026 14:02",
|
|
"product_name": "Railroads Online - Pioneer DLC",
|
|
"product_image": "https://s3.ggsel.com/gsellers-imgs-prod/e05c8d1f28e18f56334bf8e7e9f7b547.jpeg",
|
|
"total_price": 20,
|
|
"key": 'XXXX-XXXX-YYY23',
|
|
"support_email": "wstkeys@gmail.com",
|
|
"year": 2026
|
|
}
|
|
|
|
send_html_email(to_addr, data)
|
|
|
|
|
|
def main():
|
|
print("1 - Send plain email")
|
|
print("2 - Send HTML email")
|
|
|
|
choice = input("Choose: ").strip()
|
|
|
|
if choice == "1":
|
|
send_text_flow()
|
|
elif choice == "2":
|
|
send_html_flow()
|
|
else:
|
|
print("Invalid choice")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |