Thursday, May 8, 2025

Customer Relationship Management (CRM) - Email Campaign Scheduler

 


Notes:

  • Problem Solved: Automates personalized email campaign delivery based on customer actions or lifecycle stage.

  • Customization Benefits: Integrate with customer segmentation or A/B testing engines.

  • Further Adoption: Plug into SendGrid, Mailchimp, or SMTP for live delivery.

Python Code:


import smtplib
from email.mime.text import MIMEText
import pandas as pd

def send_email(recipient, subject, body):
    msg = MIMEText(body)
    msg['Subject'] = subject
    msg['From'] = 'crm@yourcompany.com'
    msg['To'] = recipient

    with smtplib.SMTP('smtp.example.com', 587) as server:
        server.starttls()
        server.login('crm@yourcompany.com', 'yourpassword')
        server.send_message(msg)

def schedule_campaign(csv_path):
    df = pd.read_csv(csv_path)
    for _, row in df.iterrows():
        subject = f"Special Offer for {row['first_name']}"
        body = f"Hi {row['first_name']},\n\nHere's something just for you: {row['offer']}\n\nBest,\nCRM Team"
        send_email(row['email'], subject, body)

# Usage
# schedule_campaign("email_campaign_data.csv")

No comments:

Post a Comment

IoT (Internet of Things) Automation - Smart Energy Usage Tracker

  Notes: Problem Solved: Logs and analyzes power usage from smart meters. Customization Benefits: Track per-device energy and set ale...