Skip to content

Instantly share code, notes, and snippets.

@OshekharO
Created June 14, 2024 06:57
Show Gist options
  • Select an option

  • Save OshekharO/b98b57fda82b43499436c5f72f84b545 to your computer and use it in GitHub Desktop.

Select an option

Save OshekharO/b98b57fda82b43499436c5f72f84b545 to your computer and use it in GitHub Desktop.

Revisions

  1. OshekharO created this gist Jun 14, 2024.
    40 changes: 40 additions & 0 deletions mail.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    import smtplib
    from email.mime.text import MIMEText

    # Replace these with your details
    sender_email = "your_email@gmail.com"
    sender_password = "your_password"
    recipient_emails = ["xyz@gmail.com", "yzx@gmail.com", "zxy@gmail.com"]
    subject = "Human Resource Executive Position - [Your Name]" # Personalized subject line

    # Body content with placeholder for hiring manager name
    body_template = """Dear [Hiring Manager name],
    I am writing to express my keen interest in the Human Resource Executive position at Reverr, as advertised on [Platform where you saw the job posting].
    As a final-year Bachelor of Commerce in Finance student with a 2-month HR internship experience, I possess a strong foundation in HR principles and practical skills in candidate shortlisting, interviewing, IT recruitment, job posting, and IT support. I am proficient in MS Office Suite (Word, Excel, PowerPoint), which enables me to efficiently manage HR tasks.
    Thanks,
    [Your Name]"""

    for recipient in recipient_emails:
    # Fill in hiring manager name (if you know it)
    body = body_template.replace("[Hiring Manager name]", "Hiring Manager" if not recipient_specific_name else recipient_specific_name)

    # Create message object with text content
    message = MIMEText(body, "plain")
    message["Subject"] = subject
    message["From"] = sender_email
    message["To"] = recipient

    # Connect to Gmail's SMTP server using secure SSL connection
    server = smtplib.SMTP_SSL("smtp.gmail.com", 465)
    server.login(sender_email, sender_password)

    # Send email
    server.sendmail(sender_email, [recipient], message.as_string())

    # Close connection
    server.quit()

    print(f"Email sent successfully to {recipient}")