schedule

code Python verified Free Download devices Cross-platform

code Code Preview

Python
#!/usr/bin/env python3
"""
Follow-up Scheduler
Schedule follow-ups based on dates and calculate optimal send times
"""
from datetime import datetime, timedelta
import csv

def schedule_followups(start_date, intervals=[3, 7, 14]):
    """Generate follow-up schedule from start date"""
    if isinstance(start_date, str):
        current = datetime.strptime(start_date, '%Y-%m-%d')
    else:
        current = start_date

    schedule = []
    for i, days in enumerate(intervals, 1):
        followup_date = current + timedelta(days=days)
        schedule.append({
            'followup': i,
            'date': followup_date.strftime('%Y-%m-%d'),
            'weekday': followup_date.strftime('%A'),
            'days_after': days
        })

    return schedule

def optimal_send_time(date_str, timezone='UTC'):
    """Calculate optimal send time (Tue-Thu, 9-11 AM)"""
    date = datetime.strptime(date_str, '%Y-%m-%d')

    # Adjust to Tuesday-Thursday (best open rates)
    weekday = date.weekday()
    if weekday == 0:  # Monday -> Tuesday
        date += timedelta(days=1)
    elif weekday == 4:  # Friday -> Tuesday
        date += timedelta(days=4)
    elif weekday >= 5:  # Weekend -> Tuesday
        date += timedelta(days=(8 - weekday))

    # Set optimal time (10 AM)
    send_time = date.replace(hour=10, minute=0, second=0)
    return send_time.strftime('%Y-%m-%d %H:%M')

def export_schedule(contacts, start_date, output_file='schedule.csv'):
    """Export schedule for all contacts"""
    with open(output_file, 'w', newline='') as f:
        writer = csv.writer(f)
        writer.writerow(['email', 'followup', 'send_date', 'send_time'])
        for contact in contacts:
            schedule = schedule_followups(start_date)
            for item in schedule:
                send_time = optimal_send_time(item['date'])
                writer.writerow([contact, item['followup'], item['date'], send_time])

if __name__ == '__main__':
    schedule = schedule_followups('2025-01-15')
    for item in schedule:
        print(f"Followup {item['followup']}: {item['date']} ({item['weekday']})")

info About This Tool

The Follow-up Scheduler calculates optimal send times and generates follow-up sequences. Automate your timing strategy for better response rates.

Key Features

  • Custom Intervals - Set follow-up timing (default: 3, 7, 14 days)
  • Optimal Timing - Auto-adjusts to best days (Tue-Thu)
  • Time Optimization - Schedules for peak open rates (9-11 AM)
  • Bulk Scheduling - Generate schedules for entire contact lists
  • CSV Export - Ready for import into email tools

Optimal Timing Rules

  • Best Days - Tuesday, Wednesday, Thursday
  • Best Time - 9-11 AM recipient local time
  • Avoid - Mondays, Fridays, weekends

Requirements

  • Python 3.7+
  • No external dependencies

Pro Tip: Emails sent Tuesday-Thursday at 10 AM have 25% higher open rates than weekend sends.

download Download Script

Need Full Automation?

Try Postigo for automated email campaigns with AI personalization

rocket_launch Start Free Trial