This script searches for a keyword in a craigslist URL, and then automatically sends an email to each poster. The body of the email can be set in the options variable.
Implemented in nodejs using the Selenium module.
Disclaimer: Please Note that this is a research project. I am by no means responsible for any usage of this tool. Use on your own behalf. I’m also not responsible if your get into any trouble due to extensive use of this tool.
- Getting Started
- Basic Installation
- Gmail Settings
- [Chrome Driver] (#chrome-driver)
- Run the Script
1. git clone https://github.com/ourarash/craigslist-emailer.git
2. cd craigslist-emailer
3. npm install
Set searchURL, searchTerm, your email, password, emailBody, and SMTP servers in index.js
// Fill out these options
var options = {
searchURL: "https://sfbay.craigslist.org/d/furniture/search/fua", //The page we are searching
searchTerm: "tv", //The keyword we are searching
printBody: false,
printTitle: true,
badWords: ["badword1", "badword2"], //Detects bad words in title and body of each text
fromName: 'Your-name', //Sender name in the email being sent
email: "uid@gmail.com", //Your email address
password: "password", //Your password
smtpServer: 'smtp.gmail.com', //SMTP server. Use smtp.gmail.com for gmail
//The body of email sent to each poster
emailBody: `Hi,
What is your lowest price?
Thanks,
John Doe
`,
};
If you use Gmail, in order to send emails using this script, you will need to set Gmail to allow sending email from less secure sources. Gmail will send you an email with instructions once you run this script for the first time.
Alternatively, you can set it from here: https://myaccount.google.com/lesssecureapps
The latest version of Chrome driver is included in this repo, but make sure that you have the latest version by downloading it from here:
https://sites.google.com/a/chromium.org/chromedriver/downloads
Also you will need to download the chromedriver if you are using a non Windows/Mac OS.
Execute it:
$ node index.js