New Year Greetings to all contacts
As 2014 ended, I figured it was a good time to send out a New Year's Greeting to all of my professional contacts. But, with over a thousand contacts on LinkedIn alone, it would have been a several days of work to compose an email individually. It should be possible to download all of the LinkedIn contacts and then script a custom email to every one.
Step 1: Export LinkedIn contacts
From LinkedIn Connections, select "Manage Sources" (accessed via the gear icon on the connections page). At the top right, there is a link to export contacts.https://www.linkedin.com/contacts/manage_sources/ page |
Step 2: Script to send a custom email to every contact
#!/usr/bin/env python26
import csv
import smtplib
import time
sender='myemail@domain.com'
message="""From: myemail@domain.com
Return-path: myemail@domain.com
Reply-to: myemail@domain.com
To: {0} {1} <{2}>
Subject: Hi {0}, Happy New Year 2015
Dear {0}, Greetings!
Message you want to send.
Happy New Year 2015.
Signature
"""
# CSV Format: FirstName,LastName,Email
f = open('data.csv', 'r')
try:
reader = csv.reader(f)
for row in reader:
print row[2]
if row[2] != "": # data.csv may be missing an email address
msg=message.format(row[0], row[1], row[2])
server = smtplib.SMTP('localhost')
server.sendmail(sender, row[2], msg)
server.quit()
time.sleep(10) # Meter your messages. SMTP relays block messages if too many are sent quickly.
finally:
f.close()
For a thousand contacts, this script will run for about 3 hours sending one email every 10 seconds.
I had neglected to meter the messages, so only about half of my contacts got the email. The other half didn't ... (Sorry, didn't mean to ignore you)
ReplyDelete