Family mailing list python

Here is an example of a simple family mailing list program in Python:

# Family Mailing List Program

# Define a dictionary to store the family members and their contact information
family_members = {
    "John": {"email": "[email protected]", "phone": "555-1234"},
    "Jane": {"email": "[email protected]", "phone": "555-5678"},
    "Bob": {"email": "[email protected]", "phone": "555-9012"},
    "Alice": {"email": "[email protected]", "phone": "555-1111"}
}

# Define a function to add a new family member to the list
def add_family_member(name, email, phone):
    family_members[name] = {"email": email, "phone": phone}
    print(f"Added {name} to the family mailing list.")

# Define a function to remove a family member from the list
def remove_family_member(name):
    if name in family_members:
        del family_members[name]
        print(f"Removed {name} from the family mailing list.")
    else:
        print(f"{name} is not in the family mailing list.")

# Define a function to send an email to all family members
def send_email(subject, message):
    for name, contact_info in family_members.items():
        email = contact_info["email"]
        print(f"Sending email to {name} at {email}:")
        print(f"Subject: {subject}")
        print(f"Message: {message}")
        # TO DO: implement email sending functionality

# Define a function to print the family mailing list
def print_family_list():
    print("Family Mailing List:")
    for name, contact_info in family_members.items():
        print(f"{name}: {contact_info['email']} ({contact_info['phone']})")

# Main program loop
while True:
    print("Family Mailing List Menu:")
    print("1. Add family member")
    print("2. Remove family member")
    print("3. Send email to all family members")
    print("4. Print family mailing list")
    print("5. Quit")
    choice = input("Enter your choice: ")

    if choice == "1":
        name = input("Enter the name of the new family member: ")
        email = input("Enter the email address of the new family member: ")
        phone = input("Enter the phone number of the new family member: ")
        add_family_member(name, email, phone)
    elif choice == "2":
        name = input("Enter the name of the family member to remove: ")
        remove_family_member(name)
    elif choice == "3":
        subject = input("Enter the subject of the email: ")
        message = input("Enter the message of the email: ")
        send_email(subject, message)
    elif choice == "4":
        print_family_list()
    elif choice == "5":
        break
    else:
        print("Invalid choice. Please try again.")

This program defines a dictionary family_members to store the family members and their contact information. It also defines several functions to add, remove, and send emails to family members, as well as to print the family mailing list.

The main program loop allows the user to interact with the program by choosing from a menu of options. The user can add a new family member, remove an existing family member, send an email to all family members, print the family mailing list, or quit the program.

Note that this is a very basic implementation, and you may want to add additional features such as error handling, data validation, and more advanced email sending functionality.