import pandas as pd # import smtplib # import ssl import os # from email.mime.text import MIMEText # from email.mime.multipart import MIMEMultipart # from sendgrid import SendGridAPIClient # from sendgrid.helpers.mail import Mail from dotenv import load_dotenv from datetime import datetime, timedelta load_dotenv() class Schedule: def __init__(self): # Email server configuration commented out # self.server = "smtp.gmail.com" # self.port = 587 # self.sender = "axionai101@gmail.com" # self.password = os.getenv("app_password") pass def defaults(self,start_date,start_time,slot_length): self.date = start_date self.time = start_time self.slot_length = slot_length def schedule_slots(self, file_path): self.df = pd.read_csv(file_path) # Combine date and time into datetime object start_datetime = datetime.strptime( f"{self.date} {self.time}", "%Y-%m-%d %H:%M" ) slots = [] for i in range(len(self.df)): slot_start = start_datetime + timedelta(minutes=i * self.slot_length) slot_end = slot_start + timedelta(minutes=self.slot_length) slot_str = f"{slot_start.strftime('%Y-%m-%d %H:%M')} - {slot_end.strftime('%H:%M')}" slots.append(slot_str) self.df["Slot"] = slots # Function to send interview emails - COMMENTED OUT def send_emails(self): # Email sending functionality disabled print(f"Email sending disabled. Would have sent {len(self.df)} interview invitations.") return True # Return success for compatibility # Original email sending code commented out: # SENDGRID_API_KEY = os.getenv("SendGrid_Secret") # SENDER_EMAIL = os.getenv("EMAIL") # Verified sender email in SendGrid # if not SENDGRID_API_KEY or not SENDER_EMAIL: # logging.error("SendGrid API key or sender email not set in environment variables.") # return # sg_client = SendGridAPIClient(SENDGRID_API_KEY) # print("Starting SendGrid email sending") # for _, row in candidates.iterrows(): # recipient_email = row['Email'] # name = row['Name'] # interview_date = row["alloted"][:10].strip() # interview_time = row["alloted"][10:].strip() # unique_id = datetime.now().strftime("%Y%m%d%H%M%S") # subject = f"Your Interview at WeHack is Scheduled 🚀 [Ref: {unique_id}]" # # Customize the email HTML content as needed # body = f""" # #
#Dear {name},
#We are pleased to inform you that, following a review of your application, # you have been selected to proceed to the next stage of the hiring process at WeHack.
#Date: {interview_date}
# Time: {interview_time}
# Mode: Will be contacted further
This interview presents an excellent opportunity for us to further explore your qualifications, # experiences, and interest in the position. We are eager to learn more about you and how you envision contributing to our team.
#Please ensure your availability at the scheduled time. Should you have any questions, need to reschedule, # or require assistance, do not hesitate to contact us.
#We look forward to our conversation and appreciate your continued interest in joining WeHack.
##
Kind regards,
# HR
# WeHack Organization
# [Contact Information]