draftpilot 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ # Required: LLM API key (Cerebras, or any OpenAI-compatible provider)
2
+ CEREBRAS_API_KEY=your_cerebras_api_key_here
3
+
4
+ # Optional: Hunter.io API key for email discovery
5
+ HUNTER_API_KEY=your_hunter_api_key_here
6
+
7
+ # Optional: Custom config directory (default: ./config/ or ~/.draftpilot/)
8
+ DRAFTPILOT_CONFIG=./config
@@ -0,0 +1,20 @@
1
+ name: Deploy to VPS
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+
7
+ jobs:
8
+ deploy:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Deploy via SSH
12
+ uses: appleboy/ssh-action@v1
13
+ with:
14
+ host: ${{ secrets.VPS_HOST }}
15
+ username: ${{ secrets.VPS_USER }}
16
+ key: ${{ secrets.VPS_SSH_KEY }}
17
+ script: |
18
+ cd ~/email-outreach
19
+ git pull origin master
20
+ source venv/bin/activate && pip install -e . -q
@@ -0,0 +1,29 @@
1
+ # Credentials and secrets
2
+ credentials.json
3
+ token.json
4
+ .env
5
+
6
+ # Database
7
+ state.db
8
+
9
+ # User data
10
+ companies.csv
11
+ logs/
12
+
13
+ # Python
14
+ __pycache__/
15
+ *.py[cod]
16
+ *$py.class
17
+ *.egg-info/
18
+ dist/
19
+ build/
20
+
21
+ # Virtual environments
22
+ venv/
23
+ .venv/
24
+
25
+ # IDE
26
+ .idea/
27
+ .vscode/
28
+ *.swp
29
+ *.swo
@@ -0,0 +1,33 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to a positive environment:
10
+
11
+ - Demonstrating empathy and kindness toward other people
12
+ - Being respectful of differing opinions, viewpoints, and experiences
13
+ - Giving and gracefully accepting constructive feedback
14
+ - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
15
+ - Focusing on what is best not just for us as individuals, but for the overall community
16
+
17
+ Examples of unacceptable behavior:
18
+
19
+ - The use of sexualized language or imagery, and sexual attention or advances of any kind
20
+ - Trolling, insulting or derogatory comments, and personal or political attacks
21
+ - Public or private harassment
22
+ - Publishing others' private information, such as a physical or email address, without their explicit permission
23
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Enforcement
26
+
27
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainers. All complaints will be reviewed and investigated promptly and fairly.
28
+
29
+ Project maintainers are responsible for clarifying and enforcing standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Attribution
32
+
33
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
@@ -0,0 +1,56 @@
1
+ # Contributing to DraftPilot
2
+
3
+ Thank you for your interest in contributing to DraftPilot.
4
+
5
+ ## Getting Started
6
+
7
+ 1. Fork the repository on GitHub.
8
+ 2. Clone your fork locally:
9
+ ```
10
+ git clone https://github.com/<your-username>/draftpilot.git
11
+ cd draftpilot
12
+ ```
13
+ 3. Create a branch for your changes:
14
+ ```
15
+ git checkout -b my-feature
16
+ ```
17
+
18
+ ## Development Setup
19
+
20
+ Create a virtual environment and install the project in development mode:
21
+
22
+ ```
23
+ python3 -m venv venv
24
+ source venv/bin/activate
25
+ pip install -e ".[dev]"
26
+ ```
27
+
28
+ ## Running Tests
29
+
30
+ ```
31
+ pytest
32
+ ```
33
+
34
+ ## Linting
35
+
36
+ ```
37
+ ruff check .
38
+ ```
39
+
40
+ ## Code Style
41
+
42
+ - We use [ruff](https://docs.astral.sh/ruff/) for linting and formatting.
43
+ - Maximum line length is 100 characters.
44
+ - Follow existing conventions in the codebase.
45
+
46
+ ## Submitting a Pull Request
47
+
48
+ 1. Ensure all tests pass and linting is clean.
49
+ 2. Commit your changes with a clear, concise message.
50
+ 3. Push your branch to your fork.
51
+ 4. Open a pull request against the `main` branch.
52
+ 5. Describe what your PR does and why.
53
+
54
+ ## Good First Issues
55
+
56
+ Check the [Issues](../../issues) tab for issues labeled `good first issue`. These are a good starting point for new contributors.
@@ -0,0 +1,189 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including
48
+ the original version of the Work and any modifications or additions
49
+ to that Work or Derivative Works thereof, that is intentionally
50
+ submitted to the Licensor for inclusion in the Work by the copyright owner
51
+ or by an individual or Legal Entity authorized to submit on behalf of
52
+ the copyright owner. For the purposes of this definition, "submitted"
53
+ means any form of electronic, verbal, or written communication sent
54
+ to the Licensor or its representatives, including but not limited to
55
+ communication on electronic mailing lists, source code control systems,
56
+ and issue tracking systems that are managed by, or on behalf of, the
57
+ Licensor for the purpose of discussing and improving the Work, but
58
+ excluding communication that is conspicuously marked or otherwise
59
+ designated in writing by the copyright owner as "Not a Contribution."
60
+
61
+ "Contributor" shall mean Licensor and any individual or Legal Entity
62
+ on behalf of whom a Contribution has been received by the Licensor and
63
+ subsequently incorporated within the Work.
64
+
65
+ 2. Grant of Copyright License. Subject to the terms and conditions of
66
+ this License, each Contributor hereby grants to You a perpetual,
67
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
68
+ copyright license to reproduce, prepare Derivative Works of,
69
+ publicly display, publicly perform, sublicense, and distribute the
70
+ Work and such Derivative Works in Source or Object form.
71
+
72
+ 3. Grant of Patent License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ (except as stated in this section) patent license to make, have made,
76
+ use, offer to sell, sell, import, and otherwise transfer the Work,
77
+ where such license applies only to those patent claims licensable
78
+ by such Contributor that are necessarily infringed by their
79
+ Contribution(s) alone or by combination of their Contribution(s)
80
+ with the Work to which such Contribution(s) was submitted. If You
81
+ institute patent litigation against any entity (including a
82
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
83
+ or a Contribution incorporated within the Work constitutes direct
84
+ or contributory patent infringement, then any patent licenses
85
+ granted to You under this License for that Work shall terminate
86
+ as of the date such litigation is filed.
87
+
88
+ 4. Redistribution. You may reproduce and distribute copies of the
89
+ Work or Derivative Works thereof in any medium, with or without
90
+ modifications, and in Source or Object form, provided that You
91
+ meet the following conditions:
92
+
93
+ (a) You must give any other recipients of the Work or
94
+ Derivative Works a copy of this License; and
95
+
96
+ (b) You must cause any modified files to carry prominent notices
97
+ stating that You changed the files; and
98
+
99
+ (c) You must retain, in the Source form of any Derivative Works
100
+ that You distribute, all copyright, patent, trademark, and
101
+ attribution notices from the Source form of the Work,
102
+ excluding those notices that do not pertain to any part of
103
+ the Derivative Works; and
104
+
105
+ (d) If the Work includes a "NOTICE" text file as part of its
106
+ distribution, then any Derivative Works that You distribute must
107
+ include a readable copy of the attribution notices contained
108
+ within such NOTICE file, excluding any notices that do not
109
+ pertain to any part of the Derivative Works, in at least one
110
+ of the following places: within a NOTICE text file distributed
111
+ as part of the Derivative Works; within the Source form or
112
+ documentation, if provided along with the Derivative Works; or,
113
+ within a display generated by the Derivative Works, if and
114
+ wherever such third-party notices normally appear. The contents
115
+ of the NOTICE file are for informational purposes only and
116
+ do not modify the License. You may add Your own attribution
117
+ notices within Derivative Works that You distribute, alongside
118
+ or as an addendum to the NOTICE text from the Work, provided
119
+ that such additional attribution notices cannot be construed
120
+ as modifying the License.
121
+
122
+ You may add Your own copyright statement to Your modifications and
123
+ may provide additional or different license terms and conditions
124
+ for use, reproduction, or distribution of Your modifications, or
125
+ for any such Derivative Works as a whole, provided Your use,
126
+ reproduction, and distribution of the Work otherwise complies with
127
+ the conditions stated in this License.
128
+
129
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
130
+ any Contribution intentionally submitted for inclusion in the Work
131
+ by You to the Licensor shall be under the terms and conditions of
132
+ this License, without any additional terms or conditions.
133
+ Notwithstanding the above, nothing herein shall supersede or modify
134
+ the terms of any separate license agreement you may have executed
135
+ with Licensor regarding such Contributions.
136
+
137
+ 6. Trademarks. This License does not grant permission to use the trade
138
+ names, trademarks, service marks, or product names of the Licensor,
139
+ except as required for reasonable and customary use in describing the
140
+ origin of the Work and reproducing the content of the NOTICE file.
141
+
142
+ 7. Disclaimer of Warranty. Unless required by applicable law or
143
+ agreed to in writing, Licensor provides the Work (and each
144
+ Contributor provides its Contributions) on an "AS IS" BASIS,
145
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
146
+ implied, including, without limitation, any warranties or conditions
147
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
148
+ PARTICULAR PURPOSE. You are solely responsible for determining the
149
+ appropriateness of using or redistributing the Work and assume any
150
+ risks associated with Your exercise of permissions under this License.
151
+
152
+ 8. Limitation of Liability. In no event and under no legal theory,
153
+ whether in tort (including negligence), contract, or otherwise,
154
+ unless required by applicable law (such as deliberate and grossly
155
+ negligent acts) or agreed to in writing, shall any Contributor be
156
+ liable to You for damages, including any direct, indirect, special,
157
+ incidental, or consequential damages of any character arising as a
158
+ result of this License or out of the use or inability to use the
159
+ Work (including but not limited to damages for loss of goodwill,
160
+ work stoppage, computer failure or malfunction, or any and all
161
+ other commercial damages or losses), even if such Contributor
162
+ has been advised of the possibility of such damages.
163
+
164
+ 9. Accepting Warranty or Additional Liability. While redistributing
165
+ the Work or Derivative Works thereof, You may choose to offer,
166
+ and charge a fee for, acceptance of support, warranty, indemnity,
167
+ or other liability obligations and/or rights consistent with this
168
+ License. However, in accepting such obligations, You may act only
169
+ on Your own behalf and on Your sole responsibility, not on behalf
170
+ of any other Contributor, and only if You agree to indemnify,
171
+ defend, and hold each Contributor harmless for any liability
172
+ incurred by, or claims asserted against, such Contributor by reason
173
+ of your accepting any such warranty or additional liability.
174
+
175
+ END OF TERMS AND CONDITIONS
176
+
177
+ Copyright 2026 Alae Eddine Jahid
178
+
179
+ Licensed under the Apache License, Version 2.0 (the "License");
180
+ you may not use this file except in compliance with the License.
181
+ You may obtain a copy of the License at
182
+
183
+ http://www.apache.org/licenses/LICENSE-2.0
184
+
185
+ Unless required by applicable law or agreed to in writing, software
186
+ distributed under the License is distributed on an "AS IS" BASIS,
187
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
188
+ See the License for the specific language governing permissions and
189
+ limitations under the License.
@@ -0,0 +1,343 @@
1
+ Metadata-Version: 2.4
2
+ Name: draftpilot
3
+ Version: 0.1.0
4
+ Summary: Dead man's switch email outreach with AI personalization
5
+ Project-URL: Homepage, https://github.com/Alae-J/draftpilot
6
+ Project-URL: Repository, https://github.com/Alae-J/draftpilot
7
+ Project-URL: Issues, https://github.com/Alae-J/draftpilot/issues
8
+ Author: Alae Eddine Jahid
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: ai,automation,cold-email,drafts,email,gmail,outreach
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Communications :: Email
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: beautifulsoup4>=4.12.0
23
+ Requires-Dist: dnspython>=2.4.0
24
+ Requires-Dist: email-validator>=2.0.0
25
+ Requires-Dist: google-api-python-client>=2.100.0
26
+ Requires-Dist: google-auth-httplib2>=0.2.0
27
+ Requires-Dist: google-auth-oauthlib>=1.2.0
28
+ Requires-Dist: httpx>=0.25.0
29
+ Requires-Dist: openai>=1.0.0
30
+ Requires-Dist: pyyaml>=6.0
31
+ Requires-Dist: rich>=13.0.0
32
+ Requires-Dist: typer>=0.9.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest-cov; extra == 'dev'
35
+ Requires-Dist: pytest>=7.0; extra == 'dev'
36
+ Requires-Dist: ruff; extra == 'dev'
37
+ Description-Content-Type: text/markdown
38
+
39
+ # DraftPilot
40
+
41
+ **AI writes Gmail drafts. You review. Undeleted drafts auto-send.**
42
+
43
+ Most AI email tools send for you or wait for you to click Send. DraftPilot does neither: it drafts to Gmail, you review, and if you don't delete it, it fires automatically after 6 hours. Human judgment, zero manual effort.
44
+
45
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
46
+ [![Python](https://img.shields.io/badge/Python-3.10+-green.svg)](https://python.org)
47
+
48
+ ---
49
+
50
+ ## How It Works
51
+
52
+ ```
53
+ 1. You provide a CSV of companies + a YAML profile with your info
54
+ 2. DraftPilot generates personalized emails via LLM
55
+ 3. Drafts appear in Gmail under a labeled folder
56
+ 4. You review - delete the bad ones, leave the good ones
57
+ 5. After 6 hours - undeleted drafts auto-send (the dead man's switch)
58
+ ```
59
+
60
+ ```
61
+ CSV + Profile --> LLM generates email --> Gmail draft created
62
+ |
63
+ You review in Gmail
64
+ / \
65
+ Delete it Leave it
66
+ | |
67
+ Cancelled Auto-sends
68
+ after 6 hours
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Features
74
+
75
+ - **Dead man's switch** - Drafts auto-send after a configurable delay. Delete to cancel, ignore to approve.
76
+ - **AI personalization** - Uses any OpenAI-compatible LLM (Cerebras, Groq, OpenAI) to write emails tailored to each company
77
+ - **30+ anti-cliche rules** - A rules engine that prevents "I hope this finds you well", "passionate", and other template-sounding phrases
78
+ - **Multi-source email finder** - Scrapes job boards, company websites, and Hunter.io to find real recruitment emails
79
+ - **MX validation** - Checks if email domains actually accept mail before sending
80
+ - **Full audit trail** - SQLite database tracks every email: pending, drafted, sent, cancelled, error
81
+ - **HTML emails** - Clickable links for portfolio and CV in the signature
82
+ - **Bilingual** - Generates emails in French or English based on company language
83
+ - **Rate limiting** - Smart backoff and retry logic for LLM APIs
84
+ - **Cron-ready** - Set it up once and it runs daily
85
+
86
+ ---
87
+
88
+ ## Quick Start
89
+
90
+ ### Install
91
+
92
+ ```bash
93
+ pip install draftpilot
94
+ ```
95
+
96
+ Or from source:
97
+
98
+ ```bash
99
+ git clone https://github.com/Alae-J/draftpilot.git
100
+ cd draftpilot
101
+ pip install -e .
102
+ ```
103
+
104
+ ### Configure
105
+
106
+ ```bash
107
+ # Copy example configs
108
+ mkdir -p config
109
+ cp examples/profile.yaml config/
110
+ cp examples/templates.yaml config/
111
+
112
+ # Edit with your info
113
+ nano config/profile.yaml
114
+
115
+ # Set your LLM API key
116
+ export CEREBRAS_API_KEY="your-key-here"
117
+ ```
118
+
119
+ ### Authenticate with Gmail
120
+
121
+ ```bash
122
+ draftpilot auth
123
+ ```
124
+
125
+ This opens a browser for Google OAuth. You need a Google Cloud project with Gmail API enabled. [Setup guide](#gmail-setup).
126
+
127
+ ### Run
128
+
129
+ ```bash
130
+ # Generate drafts from a company list
131
+ draftpilot draft --csv companies.csv --batch 20
132
+
133
+ # Check your Gmail - review the drafts under the "DraftPilot" label
134
+ # Delete any you don't like
135
+
136
+ # Trigger the dead man's switch (or let cron do it)
137
+ draftpilot send
138
+
139
+ # Check stats
140
+ draftpilot status --list
141
+ ```
142
+
143
+ ---
144
+
145
+ ## CLI Commands
146
+
147
+ | Command | Description |
148
+ |---------|-------------|
149
+ | `draftpilot draft` | Generate personalized email drafts |
150
+ | `draftpilot send` | Auto-send drafts past their validation window |
151
+ | `draftpilot status` | Display pipeline statistics |
152
+ | `draftpilot find` | Find recruitment emails via web scraping |
153
+ | `draftpilot validate` | Validate emails (syntax + MX check) |
154
+ | `draftpilot auth` | Gmail OAuth setup |
155
+
156
+ ### Draft options
157
+
158
+ ```bash
159
+ draftpilot draft --csv companies.csv # company list
160
+ draftpilot draft --batch 30 # emails per run (default: 50)
161
+ draftpilot draft --delay 12 # hours before auto-send (default: 6)
162
+ draftpilot draft --dry-run # generate without creating drafts
163
+ ```
164
+
165
+ ### Find emails
166
+
167
+ ```bash
168
+ # Input: CSV with company_name and website columns
169
+ # Output: CSV with company_name, email, website, description, language, sector
170
+ draftpilot find --csv company_names.csv
171
+ draftpilot find --csv company_names.csv --no-hunter # skip Hunter.io
172
+ draftpilot find --csv company_names.csv --no-llm # skip LLM descriptions
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Configuration
178
+
179
+ ### Profile (`config/profile.yaml`)
180
+
181
+ Your personal info, skills, experience, and preferences. See [examples/profile.yaml](examples/profile.yaml) for the full template.
182
+
183
+ Key sections:
184
+
185
+ ```yaml
186
+ name: "Your Name"
187
+ email: "you@gmail.com"
188
+ phone: "+1 234 567 8900"
189
+ portfolio: "https://your-site.com"
190
+
191
+ education:
192
+ school: "Your University"
193
+ school_short: "University" # used in subject lines
194
+
195
+ experience:
196
+ - name: "Project X"
197
+ role: "Developer"
198
+ description: "What you built"
199
+ tech: "Python, React"
200
+
201
+ # LLM provider (any OpenAI-compatible API)
202
+ llm:
203
+ base_url: "https://api.cerebras.ai/v1"
204
+ model: "qwen-3-235b-a22b-instruct-2507"
205
+ api_key_env: "CEREBRAS_API_KEY"
206
+
207
+ # Email signature (uses $variable substitution)
208
+ signature:
209
+ fr: "$name | $school_short\n$phone | <a href=\"$portfolio\">Portfolio</a>"
210
+ en: "$name | $school_short\n$phone | <a href=\"$portfolio\">Portfolio</a>"
211
+ ```
212
+
213
+ ### Templates (`config/templates.yaml`)
214
+
215
+ Controls the email structure and rules. Ships with French and English templates. See [examples/templates.yaml](examples/templates.yaml).
216
+
217
+ The rules engine enforces:
218
+ - Greeting on its own line
219
+ - Company-first opening (not self-introduction)
220
+ - No cliches ("I hope this finds you well", "passionate", etc.)
221
+ - Word limit (150 words max)
222
+ - Proper accent marks in French
223
+ - Call-to-action with specific days
224
+ - And 20+ more rules
225
+
226
+ ### LLM Providers
227
+
228
+ DraftPilot works with any OpenAI-compatible API:
229
+
230
+ | Provider | Free Tier | Model |
231
+ |----------|-----------|-------|
232
+ | [Cerebras](https://cerebras.ai) | 14,400 req/day, 1M tokens/day | Qwen 235B |
233
+ | [Groq](https://groq.com) | 1,000 req/day, 100K tokens/day | Llama 3.3 70B |
234
+ | [OpenAI](https://openai.com) | Pay per use | GPT-4o |
235
+ | [Together](https://together.ai) | Free tier available | Llama 3.3 70B |
236
+
237
+ Just change `llm.base_url` and `llm.model` in your profile.
238
+
239
+ ---
240
+
241
+ ## Gmail Setup
242
+
243
+ 1. Go to [Google Cloud Console](https://console.cloud.google.com)
244
+ 2. Create a project and enable the **Gmail API**
245
+ 3. Go to **APIs & Services > Credentials > Create Credentials > OAuth 2.0 Client ID**
246
+ 4. Select **Desktop app**, download the JSON
247
+ 5. Save as `config/credentials.json`
248
+ 6. Add yourself as a test user under **OAuth consent screen > Test users**
249
+ 7. Run `draftpilot auth`
250
+
251
+ ---
252
+
253
+ ## Cron Setup (Automated Daily Runs)
254
+
255
+ ```bash
256
+ # Edit crontab
257
+ crontab -e
258
+
259
+ # Add these lines:
260
+ CEREBRAS_API_KEY=your-key-here
261
+
262
+ # Generate drafts every day at 8am
263
+ 0 8 * * * cd /path/to/project && /path/to/venv/bin/draftpilot draft >> logs/generate.log 2>&1
264
+
265
+ # Check and send every 30 minutes
266
+ */30 * * * * cd /path/to/project && /path/to/venv/bin/draftpilot send >> logs/send.log 2>&1
267
+ ```
268
+
269
+ ---
270
+
271
+ ## Email Finder Pipeline
272
+
273
+ DraftPilot includes a multi-source email finder that scrapes real email addresses:
274
+
275
+ 1. **Rekrute.com** - Morocco's largest job board (extracts emails from job postings)
276
+ 2. **Company websites** - Scrapes /contact, /careers, /recrutement pages for mailto: links
277
+ 3. **Hunter.io API** - Domain-based email search (50 free credits/month)
278
+ 4. **MX validation** - Filters out domains that don't accept email
279
+
280
+ ```bash
281
+ # Input: just company names and websites
282
+ echo "company_name,website
283
+ TechCorp,https://techcorp.com
284
+ StartupX,https://startupx.ma" > targets.csv
285
+
286
+ # Find their emails
287
+ draftpilot find --csv targets.csv
288
+
289
+ # Output: targets_found.csv with email, description, language, sector
290
+ ```
291
+
292
+ ---
293
+
294
+ ## Responsible Use
295
+
296
+ This tool is designed for **targeted, relevant, professional outreach** - not bulk spam.
297
+
298
+ By using this tool, you agree to:
299
+ - Comply with CAN-SPAM, GDPR, CASL, and your local email laws
300
+ - Only email addresses where you have a legitimate professional basis
301
+ - Include opt-out mechanisms in all sent emails
302
+ - Honor opt-out requests immediately
303
+ - Not use this tool to send unsolicited bulk commercial email
304
+
305
+ The authors are not responsible for misuse. Email scraping and cold outreach may be regulated or restricted in your jurisdiction.
306
+
307
+ ---
308
+
309
+ ## Project Structure
310
+
311
+ ```
312
+ draftpilot/
313
+ ├── src/draftpilot/
314
+ │ ├── cli.py # Typer CLI with 6 subcommands
315
+ │ ├── config.py # Config loading, LLM client, signature rendering
316
+ │ ├── generator.py # LLM email generation + post-processing
317
+ │ ├── drafts.py # Phase 1: CSV -> LLM -> Gmail drafts
318
+ │ ├── sender.py # Phase 2: Dead man's switch auto-sender
319
+ │ ├── gmail.py # Gmail API wrapper
320
+ │ ├── db.py # SQLite state tracking
321
+ │ ├── finder.py # Multi-source email discovery
322
+ │ ├── validator.py # Email syntax + MX validation
323
+ │ └── dashboard.py # Rich terminal stats display
324
+ ├── config/
325
+ │ ├── profile.yaml # Your info (not committed)
326
+ │ └── templates.yaml # Email templates + rules
327
+ ├── examples/ # Example configs to copy
328
+ ├── tests/
329
+ ├── pyproject.toml
330
+ └── LICENSE # Apache 2.0
331
+ ```
332
+
333
+ ---
334
+
335
+ ## Contributing
336
+
337
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions and guidelines.
338
+
339
+ ---
340
+
341
+ ## License
342
+
343
+ Apache 2.0 - See [LICENSE](LICENSE) for details.