Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from tkinter import ttk
- from tkinter import messagebox
- from PIL import Image, ImageTk
- import requests
- from io import BytesIO
- from email.mime.multipart import MIMEMultipart
- from email.mime.text import MIMEText
- import smtplib
- from html_templates import stockx_delivered, shipped_to_stockx, verified_and_shipped, nikeen, nikeit, nikesnkrs, adidasit, appleen, farfetchen, zalandoit, zalandoen
- class EmailApp(tk.Tk):
- def __init__(self):
- super().__init__()
- self.info_input_fields = None
- self.image_label = None # Aggiungi un'etichetta per l'immagine
- self.title("RICETTARIO")
- self.notebook = ttk.Notebook(self)
- self.notebook.pack(fill="both", expand=True)
- self.type_selection_frame = ttk.Frame(self.notebook)
- self.language_selection_frame = ttk.Frame(self.notebook)
- self.info_input_frame = ttk.Frame(self.notebook)
- self.notebook.add(self.type_selection_frame, text="Selezione Tipo HTML")
- self.notebook.add(self.language_selection_frame, text="Selezione Tipologia")
- self.notebook.add(self.info_input_frame, text="Inserimento Informazioni")
- # Variabili per memorizzare la selezione del tipo di HTML e l'email del destinatario
- self.selected_html_type = tk.StringVar()
- self.recipient_email = tk.StringVar()
- self.selected_language = tk.StringVar()
- # Creazione delle pagine iniziali
- self.create_type_selection_page()
- self.create_language_selection_page()
- self.create_info_input_page()
- # Bind dell'evento di cambio scheda
- self.notebook.bind("<<NotebookTabChanged>>", self.on_tab_change)
- def create_type_selection_page(self):
- label_html_type = tk.Label(self.type_selection_frame, text="Seleziona Tipo di HTML:")
- label_html_type.grid(row=0, column=0, sticky=tk.W)
- html_options = ["StockX", "Nike", "Adidas", "Apple", "Farfetch", "Zalando"] # Scelte per il tipo di HTML
- html_type_menu = ttk.Combobox(
- self.type_selection_frame, textvariable=self.selected_html_type, values=html_options, state='readonly'
- )
- html_type_menu.grid(row=0, column=1, padx=5, pady=5, sticky=tk.W)
- label_email = tk.Label(self.type_selection_frame, text="Inserisci l'Email:")
- label_email.grid(row=1, column=0, sticky=tk.W)
- email_entry = tk.Entry(self.type_selection_frame, textvariable=self.recipient_email)
- email_entry.grid(row=1, column=1, padx=5, pady=5, sticky=tk.W)
- confirm_button = tk.Button(self.type_selection_frame, text="Avanti", command=self.show_language_selection_page)
- confirm_button.grid(row=2, columnspan=2, pady=10)
- def on_tab_change(self, event):
- current_tab = self.notebook.index(self.notebook.select())
- if current_tab == 1: # Language Selection Page
- if not self.validate_email() or not self.selected_html_type.get():
- messagebox.showerror("Errore", "Inserisci un'email valida e seleziona un tipo di HTML.")
- self.show_type_selection_page()
- else:
- self.update_language_options() # Aggiorna le opzioni di lingua
- self.update_language_image() # Aggiorna l'immagine
- elif current_tab == 2: # Info Input Page
- if not self.selected_language.get():
- messagebox.showerror("Errore", "Seleziona una tipologia prima di procedere.")
- self.show_language_selection_page()
- def update_language_image(self):
- if self.image_label:
- self.image_label.grid_forget() # Rimuovi l'immagine precedente
- image_url = None
- if self.selected_html_type.get() == "StockX":
- image_url = "https://upload.wikimedia.org/wikipedia/commons/9/95/Stockx_logo.png"
- elif self.selected_html_type.get() == "Nike":
- image_url = "https://logos-world.net/wp-content/uploads/2020/04/Nike-Logo.png"
- elif self.selected_html_type.get() == "Adidas":
- image_url = "https://kivasports.net/wp-content/uploads/sites/47/2022/02/adidas-logo2.png"
- elif self.selected_html_type.get() == "Apple":
- image_url = "https://seeklogo.com/images/A/apple-logo-E3DBF3AE34-seeklogo.com.png"
- elif self.selected_html_type.get() == "Farfetch":
- image_url = "https://vin.imgix.net/uploads/provider/63e0e21ad1a8f.png"
- elif self.selected_html_type.get() == "Zalando":
- image_url = "https://cdn.freebiesupply.com/logos/thumbs/2x/zalando-2-logo.png"
- if image_url:
- response = requests.get(image_url)
- image = Image.open(BytesIO(response.content))
- # Ridimensionare l'immagine se è il logo di Nike
- if self.selected_html_type.get() == "Nike":
- image = image.resize((300, 155), Image.Resampling.LANCZOS)
- elif self.selected_html_type.get() == "Adidas":
- image = image.resize((300, 155), Image.Resampling.LANCZOS)
- elif self.selected_html_type.get() == "Apple":
- image = image.resize((160, 204), Image.Resampling.LANCZOS)
- elif self.selected_html_type == "Farfetch":
- image = image.resize((300, 155), Image.Resampling.LANCZOS)
- elif self.selected_html_type == "Zalando":
- image = image.resize((300, 155), Image.Resampling.LANCZOS)
- photo_image = ImageTk.PhotoImage(image)
- self.image_label = ttk.Label(self.language_selection_frame, image=photo_image)
- self.image_label.image = photo_image
- self.image_label.grid(row=3, column=0, columnspan=2, pady=10)
- def show_type_selection_page(self):
- self.notebook.select(self.type_selection_frame)
- def show_language_selection_page(self):
- self.notebook.select(self.language_selection_frame)
- def create_language_selection_page(self):
- label_html_type = tk.Label(self.language_selection_frame, text="Tipo di HTML Selezionato:")
- label_html_type.grid(row=0, column=0, sticky=tk.W)
- selected_html_label = tk.Label(self.language_selection_frame, textvariable=self.selected_html_type)
- selected_html_label.grid(row=0, column=1, sticky=tk.W)
- label_language = tk.Label(self.language_selection_frame, text="Seleziona Tipologia:")
- label_language.grid(row=1, column=0, sticky=tk.W)
- self.language_menu = ttk.Combobox(self.language_selection_frame, textvariable=self.selected_language, state='readonly')
- self.language_menu.grid(row=1, column=1, padx=5, pady=5, sticky=tk.W)
- confirm_button = tk.Button(self.language_selection_frame, text="Avanti", command=self.show_info_input_page)
- confirm_button.grid(row=2, columnspan=2, pady=10)
- def update_language_options(self):
- html_type = self.selected_html_type.get()
- if html_type == "Nike":
- language_options = ["Ricevuta (EN)", "Ricevuta (IT)", "Sneakers (IT)"]
- elif html_type == "StockX":
- language_options = ["Consegnato (EN)", "Spedito a StockX (IT)", "Verificato e Spedito (IT)"]
- elif html_type == "Adidas":
- language_options = ["Ricevuta (IT)"]
- elif html_type == "Apple":
- language_options = ["Ricevuta (EN)"]
- elif html_type == "Farfetch":
- language_options = ["Ricevuta (EN)"]
- elif html_type == "Zalando":
- language_options = ["Ricevuta (EN)", "Ricevuta (IT)"]
- self.language_menu['values'] = language_options
- self.selected_language.set("") # Clear previous selection
- def show_info_input_page(self):
- if self.validate_email() and self.selected_html_type.get() and self.selected_language.get():
- self.notebook.select(self.info_input_frame)
- self.populate_info_input_page()
- else:
- messagebox.showerror("Errore", "Seleziona un tipo di HTML e una lingua e inserisci un'email valida.")
- def validate_email(self):
- email = self.recipient_email.get()
- if not email:
- return False
- if "@" in email and "." in email:
- return True
- else:
- return False
- def create_info_input_page(self):
- self.info_input_fields = {}
- def populate_info_input_page(self):
- for widget in self.info_input_frame.winfo_children():
- widget.grid_forget()
- if self.selected_html_type.get() == "StockX":
- if self.selected_language.get() == "Consegnato (EN)":
- self.create_stockx_delivered_info_input()
- elif self.selected_language.get() == "Spedito a StockX (IT)":
- self.create_stockx_shipped_to_stockx_info_input()
- elif self.selected_language.get() == "Verificato e Spedito (IT)":
- self.create_verified_and_shipped_info_input()
- elif self.selected_html_type.get() == "Nike":
- if self.selected_language.get() == "Ricevuta (EN)":
- self.create_nikeen_info_input()
- elif self.selected_language.get() == "Ricevuta (IT)":
- self.create_nikeit_info_input()
- elif self.selected_language.get() == "Sneakers (IT)":
- self.create_nikeit_info_input()
- elif self.selected_html_type.get() == "Adidas":
- if self.selected_language.get() == "Ricevuta (IT)":
- self.create_adidasit_info_input()
- elif self.selected_html_type.get() == "Apple":
- if self.selected_language.get() == "Ricevuta (EN)":
- self.create_appleen_info_input()
- elif self.selected_html_type.get() == "Farfetch":
- if self.selected_language.get() == "Ricevuta (EN)":
- self.create_farfetchen_info_input()
- elif self.selected_html_type.get() == "Zalando":
- if self.selected_language.get() == "Ricevuta (EN)":
- self.create_zalandoen_info_input()
- elif self.selected_language.get() == "Ricevuta (IT)":
- self.create_zalandoit_info_input()
- back_button = tk.Button(self.info_input_frame, text="Indietro", command=self.show_language_selection_page)
- back_button.grid(row=0, column=0, pady=10)
- send_button = tk.Button(self.info_input_frame, text="Invia Email", command=self.send_email)
- send_button.grid(row=0, column=1, pady=10)
- restart_button = tk.Button(self.info_input_frame, text="Riavvia", command=self.restart)
- restart_button.grid(row=0, column=2, pady=10)
- def restart(self):
- self.destroy()
- EmailApp().mainloop()
- def create_stockx_delivered_info_input(self):
- self.info_input_fields = {
- "URL Immagine": None,
- "Data di Consegna": None,
- "Nome Prodotto": None,
- "Size": None,
- "Purchase Price": None,
- "Processing Fee": None,
- "Shipping": None,
- "Total": None
- }
- row = 1
- for field_name in self.info_input_fields.keys():
- label = tk.Label(self.info_input_frame, text=field_name + ":")
- label.grid(row=row, column=0, sticky=tk.W)
- entry = tk.Entry(self.info_input_frame)
- entry.grid(row=row, column=1, padx=5, pady=5, sticky=tk.W)
- self.info_input_fields[field_name] = entry
- row += 1
- def create_stockx_shipped_to_stockx_info_input(self):
- self.info_input_fields = {
- "URL Immagine": None,
- "Data di Consegna": None,
- "Seconda Data di Consegna": None,
- "Nome Prodotto": None,
- "Size": None,
- "Purchase Price": None,
- "Processing Fee": None,
- "Shipping": None,
- "Total": None
- }
- row = 1
- for field_name in self.info_input_fields.keys():
- label = tk.Label(self.info_input_frame, text=field_name + ":")
- label.grid(row=row, column=0, sticky=tk.W)
- entry = tk.Entry(self.info_input_frame)
- entry.grid(row=row, column=1, padx=5, pady=5, sticky=tk.W)
- self.info_input_fields[field_name] = entry
- row += 1
- def create_verified_and_shipped_info_input(self):
- self.info_input_fields = {
- "URL Immagine": None,
- "Nome Prodotto": None,
- "Size": None,
- "Purchase Price": None,
- "Processing Fee": None,
- "Shipping": None,
- "Total": None,
- }
- row = 1
- for field_name in self.info_input_fields.keys():
- label = tk.Label(self.info_input_frame, text=field_name + ":")
- label.grid(row=row, column=0, sticky=tk.W)
- entry = tk.Entry(self.info_input_frame)
- entry.grid(row=row, column=1, padx=5, pady=5, sticky=tk.W)
- self.info_input_fields[field_name] = entry
- row += 1
- def create_nikeen_info_input(self):
- self.info_input_fields = {
- "URL Immagine": None,
- "Data Ordine": None,
- "Data di Consegna": None,
- "Nome Prodotto": None,
- "Size": None,
- "Prezzo Prodotto": None,
- "Nome": None,
- "Cognome": None,
- "Indirizzo": None,
- "Citta": None,
- "Stato": None,
- "CAP": None,
- "Totale": None
- }
- row = 1
- for field_name in self.info_input_fields.keys():
- label = tk.Label(self.info_input_frame, text=field_name + ":")
- label.grid(row=row, column=0, sticky=tk.W)
- entry = tk.Entry(self.info_input_frame)
- entry.grid(row=row, column=1, padx=5, pady=5, sticky=tk.W)
- self.info_input_fields[field_name] = entry
- row += 1
- def create_nikeit_info_input(self):
- self.info_input_fields = {
- "URL Immagine": None,
- "Data Ordine": None,
- "Data di Consegna": None,
- "Nome Prodotto": None,
- "Size": None,
- "Prezzo Prodotto": None,
- "Nome": None,
- "Cognome": None,
- "Indirizzo": None,
- "Citta": None,
- "Stato": None,
- "CAP": None
- }
- row = 1
- for field_name in self.info_input_fields.keys():
- label = tk.Label(self.info_input_frame, text=field_name + ":")
- label.grid(row=row, column=0, sticky=tk.W)
- entry = tk.Entry(self.info_input_frame)
- entry.grid(row=row, column=1, padx=5, pady=5, sticky=tk.W)
- self.info_input_fields[field_name] = entry
- row += 1
- def create_nikesnkrs_info_input(self):
- self.info_input_fields = {
- "URL Immagine": None,
- "Data Ordine": None,
- "Data di Consegna": None,
- "Nome Prodotto": None,
- "Size": None,
- "Prezzo Prodotto": None,
- "Nome": None,
- "Cognome": None,
- "Indirizzo": None,
- "Citta": None,
- "Stato": None,
- "CAP": None
- }
- row = 1
- for field_name in self.info_input_fields.keys():
- label = tk.Label(self.info_input_frame, text=field_name + ":")
- label.grid(row=row, column=0, sticky=tk.W)
- entry = tk.Entry(self.info_input_frame)
- entry.grid(row=row, column=1, padx=5, pady=5, sticky=tk.W)
- self.info_input_fields[field_name] = entry
- row += 1
- def create_adidasit_info_input(self):
- self.info_input_fields = {
- "URL Immagine": None,
- "Data di Consegna": None,
- "Nome Prodotto": None,
- "Size": None,
- "Colore": None,
- "ID Prodotto": None,
- "Prezzo Prodotto": None,
- "Nome": None,
- "Cognome": None,
- "Indirizzo": None,
- "Citta": None,
- "CAP": None
- }
- row = 1
- for field_name in self.info_input_fields.keys():
- label = tk.Label(self.info_input_frame, text=field_name + ":")
- label.grid(row=row, column=0, sticky=tk.W)
- entry = tk.Entry(self.info_input_frame)
- entry.grid(row=row, column=1, padx=5, pady=5, sticky=tk.W)
- self.info_input_fields[field_name] = entry
- row += 1
- def create_appleen_info_input(self):
- self.info_input_fields = {
- "URL Immagine": None,
- "Data Ordine": None,
- "Nome Prodotto": None,
- "Quantità": None,
- "Prezzo Prodotto": None,
- "Totale": None,
- "Nome": None,
- "Cognome": None,
- "Mail": None,
- "Indirizzo": None,
- "Citta": None,
- "Stato": None,
- "CAP": None
- }
- row = 1
- for field_name in self.info_input_fields.keys():
- label = tk.Label(self.info_input_frame, text=field_name + ":")
- label.grid(row=row, column=0, sticky=tk.W)
- entry = tk.Entry(self.info_input_frame)
- entry.grid(row=row, column=1, padx=5, pady=5, sticky=tk.W)
- self.info_input_fields[field_name] = entry
- row += 1
- def create_farfetchen_info_input(self):
- self.info_input_fields = {
- "URL Immagine": None,
- "Prima Data Consegna": None,
- "Seconda Data Consegna": None,
- "Numero Ordine [es: 49ZADM]": None,
- "Brand": None,
- "Nome Prodotto": None,
- "Size": None,
- "Prezzo Prodotto": None,
- "Totale [10€ in più al Prezzo]": None,
- "Nome": None,
- "Cognome": None,
- "Indirizzo": None,
- "Citta": None,
- "Stato": None,
- "CAP": None
- }
- row = 1
- for field_name in self.info_input_fields.keys():
- label = tk.Label(self.info_input_frame, text=field_name + ":")
- label.grid(row=row, column=0, sticky=tk.W)
- entry = tk.Entry(self.info_input_frame)
- entry.grid(row=row, column=1, padx=5, pady=5, sticky=tk.W)
- self.info_input_fields[field_name] = entry
- row += 1
- def create_zalandoen_info_input(self):
- self.info_input_fields = {
- "URL Immagine": None,
- "Data Ordine [Fri, 21 Apr 2023]": None,
- "Prima Data Consegna [Mon, 24 Apr 2023]": None,
- "Seconda Data Consegna [Wed, 26 Apr 2023]": None,
- "Brand": None,
- "Product Name": None,
- "Color": None,
- "Size": None,
- "Price": None,
- "Ship": None,
- "Total": None,
- "Nome": None,
- "Cognome": None,
- "Indirizzo": None,
- "Citta": None,
- "CAP": None
- }
- row = 1
- for field_name in self.info_input_fields.keys():
- label = tk.Label(self.info_input_frame, text=field_name + ":")
- label.grid(row=row, column=0, sticky=tk.W)
- entry = tk.Entry(self.info_input_frame)
- entry.grid(row=row, column=1, padx=5, pady=5, sticky=tk.W)
- self.info_input_fields[field_name] = entry
- row += 1
- def create_zalandoit_info_input(self):
- self.info_input_fields = {
- "URL Immagine": None,
- "Data Ordine [Ven, 21 Apr 2023]": None,
- "Prima Data Consegna [Lun, 24 Apr 2023]": None,
- "Seconda Data Consegna [Mer, 26 Apr 2023]": None,
- "Brand": None,
- "Nome Prodotto": None,
- "Colore": None,
- "Size": None,
- "Prezzo Prodotto": None,
- "Nome": None,
- "Cognome": None,
- "Indirizzo": None,
- "Citta": None,
- "CAP": None
- }
- row = 1
- for field_name in self.info_input_fields.keys():
- label = tk.Label(self.info_input_frame, text=field_name + ":")
- label.grid(row=row, column=0, sticky=tk.W)
- entry = tk.Entry(self.info_input_frame)
- entry.grid(row=row, column=1, padx=5, pady=5, sticky=tk.W)
- self.info_input_fields[field_name] = entry
- row += 1
- def send_email(self):
- html_type = self.selected_html_type.get()
- recipient_email = self.recipient_email.get()
- if not recipient_email:
- messagebox.showerror("Errore", "Inserisci un'email valida.")
- return
- language = self.selected_language.get()
- if html_type == "StockX":
- if self.selected_language.get() == "Consegnato (EN)":
- if not all(self.info_input_fields.values()):
- messagebox.showerror("Errore", "Inserisci tutti i campi richiesti.")
- return
- elif self.selected_language.get() == "Spedito a StockX (IT)":
- if not all(self.info_input_fields.values()):
- messagebox.showerror("Errore", "Inserisci tutti i campi richiesti.")
- return
- elif self.selected_language.get() == "Verificato e Spedito (IT)":
- if not all(self.info_input_fields.values()):
- messagebox.showerror("Errore", "Inserisci tutti i campi richiesti.")
- return
- else:
- if not all(field.get() for field in self.info_input_fields.values()):
- messagebox.showerror("Errore", "Inserisci tutti i campi richiesti.")
- return
- if html_type == "Apple":
- email_subject = self.get_email_subject(html_type, self.info_input_fields["Nome Prodotto"].get(), "", language)
- elif html_type == "Zalando":
- if language == "Ricevuta (EN)":
- email_subject = self.get_email_subject(html_type, self.info_input_fields["Product Name"].get(), self.info_input_fields["Size"].get(), language)
- else:
- email_subject = self.get_email_subject(html_type, self.info_input_fields["Nome Prodotto"].get(), self.info_input_fields["Size"].get(), language)
- if self.send_email_smtp(self.get_html_content(html_type), recipient_email, email_subject, self.selected_html_type.get()):
- messagebox.showinfo("Successo", "Email inviata con successo!")
- else:
- messagebox.showerror("Errore", "Si è verificato un errore durante l'invio dell'email.")
- @staticmethod
- def get_email_subject(html_type, product_name, size, language):
- if html_type == "StockX":
- if language == "Consegnato (EN)":
- return f"🎉 Ordine Consegnato: {product_name} (Taglia {size})"
- elif language == "Spedito a StockX (IT)":
- return f"📦 L'ordine è stato spedito a StockX: {product_name}"
- elif language == "Verificato e Spedito (IT)":
- return f"✅ Ordine verificato e spedito: {product_name}"
- elif html_type == "Nike":
- if language == "Ricevuta (EN)":
- return "Thank You for Your Order (#C13114548220)"
- elif language == "Ricevuta (IT)":
- return "Abbiamo appena ricevuto il tuo ordine"
- elif language == "Sneakers (IT)":
- return "Il tuo ordine è stato appena spedito"
- elif html_type == "Adidas":
- if language == "Ricevuta (IT)":
- return "Abbiamo ricevuto il tuo ordine adidas"
- elif html_type == "Apple":
- if language == "Ricevuta (EN)":
- return "Stiamo elaborando il tuo ordine W12420393410"
- elif html_type == "Farfetch":
- if language == "Ricevuta (EN)":
- return "Grazie per il tuo ordine. Ecco cosa puoi aspettarti ora"
- elif html_type == "Zalando":
- if language == "Ricevuta (IT)":
- return "Grazie per il tuo ordine"
- elif language == "Ricevuta (EN)":
- return "Thanks for your order"
- def get_html_content(self, html_type):
- language = self.selected_language.get()
- if html_type == "StockX":
- if language == "Consegnato (EN)":
- return stockx_delivered(
- self.info_input_fields["URL Immagine"].get(),
- self.info_input_fields["Data di Consegna"].get(),
- self.info_input_fields["Nome Prodotto"].get(),
- self.info_input_fields["Size"].get(),
- self.info_input_fields["Purchase Price"].get(),
- self.info_input_fields["Processing Fee"].get(),
- self.info_input_fields["Shipping"].get(),
- self.info_input_fields["Total"].get()
- )
- elif language == "Spedito a StockX (IT)":
- return shipped_to_stockx(
- self.info_input_fields["URL Immagine"].get(),
- self.info_input_fields["Data di Consegna"].get(),
- self.info_input_fields["Seconda Data di Consegna"].get(),
- self.info_input_fields["Nome Prodotto"].get(),
- self.info_input_fields["Size"].get(),
- self.info_input_fields["Purchase Price"].get(),
- self.info_input_fields["Processing Fee"].get(),
- self.info_input_fields["Shipping"].get(),
- self.info_input_fields["Total"].get()
- )
- elif language == "Verificato e Spedito (IT)":
- return verified_and_shipped(
- self.info_input_fields["URL Immagine"].get(),
- self.info_input_fields["Nome Prodotto"].get(),
- self.info_input_fields["Size"].get(),
- self.info_input_fields["Purchase Price"].get(),
- self.info_input_fields["Processing Fee"].get(),
- self.info_input_fields["Shipping"].get(),
- self.info_input_fields["Total"].get()
- )
- elif html_type == "Nike":
- if language == "Ricevuta (EN)":
- return nikeen(
- self.info_input_fields["URL Immagine"].get(),
- self.info_input_fields["Data Ordine"].get(),
- self.info_input_fields["Data di Consegna"].get(),
- self.info_input_fields["Nome Prodotto"].get(),
- self.info_input_fields["Size"].get(),
- self.info_input_fields["Prezzo Prodotto"].get(),
- self.info_input_fields["Nome"].get(),
- self.info_input_fields["Cognome"].get(),
- self.info_input_fields["Indirizzo"].get(),
- self.info_input_fields["Citta"].get(),
- self.info_input_fields["Stato"].get(),
- self.info_input_fields["CAP"].get(),
- self.info_input_fields["Totale"].get()
- )
- elif language == "Ricevuta (IT)":
- return nikeit(
- self.info_input_fields["URL Immagine"].get(),
- self.info_input_fields["Data Ordine"].get(),
- self.info_input_fields["Data di Consegna"].get(),
- self.info_input_fields["Nome Prodotto"].get(),
- self.info_input_fields["Size"].get(),
- self.info_input_fields["Prezzo Prodotto"].get(),
- self.info_input_fields["Nome"].get(),
- self.info_input_fields["Cognome"].get(),
- self.info_input_fields["Indirizzo"].get(),
- self.info_input_fields["Citta"].get(),
- self.info_input_fields["Stato"].get(),
- self.info_input_fields["CAP"].get()
- )
- elif language == "Sneakers (IT)":
- return nikesnkrs(
- self.info_input_fields["URL Immagine"].get(),
- self.info_input_fields["Data Ordine"].get(),
- self.info_input_fields["Data di Consegna"].get(),
- self.info_input_fields["Nome Prodotto"].get(),
- self.info_input_fields["Size"].get(),
- self.info_input_fields["Prezzo Prodotto"].get(),
- self.info_input_fields["Nome"].get(),
- self.info_input_fields["Cognome"].get(),
- self.info_input_fields["Indirizzo"].get(),
- self.info_input_fields["Citta"].get(),
- self.info_input_fields["Stato"].get(),
- self.info_input_fields["CAP"].get()
- )
- elif html_type == "Adidas":
- if language == "Ricevuta (IT)":
- return adidasit(
- self.info_input_fields["URL Immagine"].get(),
- self.info_input_fields["Data di Consegna"].get(),
- self.info_input_fields["Nome Prodotto"].get(),
- self.info_input_fields["Size"].get(),
- self.info_input_fields["Colore"].get(),
- self.info_input_fields["ID Prodotto"].get(),
- self.info_input_fields["Prezzo Prodotto"].get(),
- self.info_input_fields["Nome"].get(),
- self.info_input_fields["Cognome"].get(),
- self.info_input_fields["Indirizzo"].get(),
- self.info_input_fields["Citta"].get(),
- self.info_input_fields["CAP"].get()
- )
- elif html_type == "Apple":
- if language == "Ricevuta (EN)":
- return appleen(
- self.info_input_fields["URL Immagine"].get(),
- self.info_input_fields["Data Ordine"].get(),
- self.info_input_fields["Nome Prodotto"].get(),
- self.info_input_fields["Quantità"].get(),
- self.info_input_fields["Prezzo Prodotto"].get(),
- self.info_input_fields["Totale"].get(),
- self.info_input_fields["Nome"].get(),
- self.info_input_fields["Cognome"].get(),
- self.info_input_fields["Mail"].get(),
- self.info_input_fields["Indirizzo"].get(),
- self.info_input_fields["Citta"].get(),
- self.info_input_fields["Stato"].get(),
- self.info_input_fields["CAP"].get()
- )
- elif html_type == "Farfetch":
- if language == "Ricevuta (EN)":
- return farfetchen(
- self.info_input_fields["URL Immagine"].get(),
- self.info_input_fields["Prima Data Consegna"].get(),
- self.info_input_fields["Seconda Data Consegna"].get(),
- self.info_input_fields["Numero Ordine [es: 49ZADM]"].get(),
- self.info_input_fields["Brand"].get(),
- self.info_input_fields["Nome Prodotto"].get(),
- self.info_input_fields["Size"].get(),
- self.info_input_fields["Prezzo Prodotto"].get(),
- self.info_input_fields["Totale [10€ in più al Prezzo]"].get(),
- self.info_input_fields["Nome"].get(),
- self.info_input_fields["Cognome"].get(),
- self.info_input_fields["Indirizzo"].get(),
- self.info_input_fields["Citta"].get(),
- self.info_input_fields["Stato"].get(),
- self.info_input_fields["CAP"].get()
- )
- elif html_type == "Zalando":
- if language == "Ricevuta (IT)":
- return zalandoit(
- self.info_input_fields["URL Immagine"].get(),
- self.info_input_fields["Data Ordine [Ven, 21 Apr 2023]"].get(),
- self.info_input_fields["Prima Data Consegna [Lun, 24 Apr 2023]"].get(),
- self.info_input_fields["Seconda Data Consegna [Mer, 26 Apr 2023]"].get(),
- self.info_input_fields["Brand"].get(),
- self.info_input_fields["Nome Prodotto"].get(),
- self.info_input_fields["Colore"].get(),
- self.info_input_fields["Size"].get(),
- self.info_input_fields["Prezzo Prodotto"].get(),
- self.info_input_fields["Nome"].get(),
- self.info_input_fields["Cognome"].get(),
- self.info_input_fields["Indirizzo"].get(),
- self.info_input_fields["Citta"].get(),
- self.info_input_fields["CAP"].get()
- )
- elif language == "Ricevuta (EN)":
- return zalandoen(
- self.info_input_fields["URL Immagine"].get(),
- self.info_input_fields["Data Ordine [Fri, 21 Apr 2023]"].get(),
- self.info_input_fields["Prima Data Consegna [Mon, 24 Apr 2023]"].get(),
- self.info_input_fields["Seconda Data Consegna [Wed, 26 Apr 2023]"].get(),
- self.info_input_fields["Brand"].get(),
- self.info_input_fields["Product Name"].get(),
- self.info_input_fields["Color"].get(),
- self.info_input_fields["Size"].get(),
- self.info_input_fields["Price"].get(),
- self.info_input_fields["Ship"].get(),
- self.info_input_fields["Total"].get(),
- self.info_input_fields["Nome"].get(),
- self.info_input_fields["Cognome"].get(),
- self.info_input_fields["Indirizzo"].get(),
- self.info_input_fields["Citta"].get(),
- self.info_input_fields["CAP"].get()
- )
- @staticmethod
- def send_email_smtp(html_content, recipient_email, email_subject, selected_html_type):
- try:
- smtp_server = "smtp.gmail.com"
- smtp_port = 587
- sender_email = "italianricette@gmail.com"
- sender_password = "jcnc dmte hxaj htue"
- if selected_html_type == "StockX":
- sender_name = "StockX"
- elif selected_html_type == "Nike":
- sender_name = "Nike"
- elif selected_html_type == "Adidas":
- sender_name = "Adidas"
- elif selected_html_type == "Apple":
- sender_name = "Apple"
- elif selected_html_type == "Farfetch":
- sender_name = "Farfetch"
- elif selected_html_type == "Zalando":
- sender_name = "Zalando"
- message = MIMEMultipart()
- message['From'] = f"{sender_name} <{sender_email}>"
- message['To'] = recipient_email
- message['Subject'] = email_subject
- message.attach(MIMEText(html_content, 'html'))
- server = smtplib.SMTP(smtp_server, smtp_port)
- server.starttls()
- server.login(sender_email, sender_password)
- server.sendmail(sender_email, recipient_email, message.as_string())
- server.quit()
- return True
- except Exception as e:
- print("Errore durante l'invio dell'email:", e)
- return False
- def main():
- app = EmailApp()
- app.mainloop()
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement