draft_email from yesterday creates the draft. Your advisor check-in is drafted and ready. What's the difference between drafting and sending — from a code perspective?
Same parameters — to, subject, body. Just a different action. But sending is permanent. I want to be careful about that.
Exactly the right instinct. GMAIL_SEND_EMAIL uses the same params as GMAIL_CREATE_EMAIL_DRAFT — but it sends immediately. That's why the test pattern for send actions is always send-to-self first. Your own address is the only safe test target. Never run send automation with a real recipient until you've verified the function works correctly:
result = toolset.execute_action(
Action.GMAIL_SEND_EMAIL,
{"to": "your.own@email.com", "subject": "Test send", "body": "This is a test."}
)
print(f"Send result: {result.get('status', 'unknown')}")If the params are identical to draft_email, why have both? When would I choose one over the other?
Draft for human-in-the-loop workflows — you want to review before sending. Send for fully automated workflows where the content is templated and verified. The capstone workflow uses GMAIL_CREATE_EMAIL_DRAFT so you can inspect the weekly summary before it reaches your advisor:
def send_email(to: str, subject: str, body: str) -> dict:
result = toolset.execute_action(
Action.GMAIL_SEND_EMAIL,
{"to": to, "subject": subject, "body": body}
)
print(f"Email sent to {to}: {result.get('status', 'sent')}")
return resultI could wire this to run automatically every Friday with the week's research summary — send to self to confirm it looks right, then swap the recipient when I'm ready.
The Friday routine that takes 15 minutes just became a verified function call.
Week 1 complete — read, search, draft, send. The full Gmail loop from Python. That's actually my advisor communication stack.
Send automation carries responsibility. Add a confirmation step before any non-self recipient goes into production. The most common mistake is testing with a correct-looking address that turns out to be real. Send to self, verify the output, then update the recipient.
| Action | Effect | When to use |
|---|---|---|
GMAIL_CREATE_EMAIL_DRAFT | Creates draft, human reviews | Advising workflows, review needed |
GMAIL_SEND_EMAIL | Sends immediately | Fully automated, templated content |
to = your.own@email.com firstBoth actions use the same params: to, subject, body.
A draft gives you one human checkpoint before sending. For advisor emails, one mis-addressed email is worse than the automation saving you. Use draft in development, send only in production.
draft_email from yesterday creates the draft. Your advisor check-in is drafted and ready. What's the difference between drafting and sending — from a code perspective?
Same parameters — to, subject, body. Just a different action. But sending is permanent. I want to be careful about that.
Exactly the right instinct. GMAIL_SEND_EMAIL uses the same params as GMAIL_CREATE_EMAIL_DRAFT — but it sends immediately. That's why the test pattern for send actions is always send-to-self first. Your own address is the only safe test target. Never run send automation with a real recipient until you've verified the function works correctly:
result = toolset.execute_action(
Action.GMAIL_SEND_EMAIL,
{"to": "your.own@email.com", "subject": "Test send", "body": "This is a test."}
)
print(f"Send result: {result.get('status', 'unknown')}")If the params are identical to draft_email, why have both? When would I choose one over the other?
Draft for human-in-the-loop workflows — you want to review before sending. Send for fully automated workflows where the content is templated and verified. The capstone workflow uses GMAIL_CREATE_EMAIL_DRAFT so you can inspect the weekly summary before it reaches your advisor:
def send_email(to: str, subject: str, body: str) -> dict:
result = toolset.execute_action(
Action.GMAIL_SEND_EMAIL,
{"to": to, "subject": subject, "body": body}
)
print(f"Email sent to {to}: {result.get('status', 'sent')}")
return resultI could wire this to run automatically every Friday with the week's research summary — send to self to confirm it looks right, then swap the recipient when I'm ready.
The Friday routine that takes 15 minutes just became a verified function call.
Week 1 complete — read, search, draft, send. The full Gmail loop from Python. That's actually my advisor communication stack.
Send automation carries responsibility. Add a confirmation step before any non-self recipient goes into production. The most common mistake is testing with a correct-looking address that turns out to be real. Send to self, verify the output, then update the recipient.
| Action | Effect | When to use |
|---|---|---|
GMAIL_CREATE_EMAIL_DRAFT | Creates draft, human reviews | Advising workflows, review needed |
GMAIL_SEND_EMAIL | Sends immediately | Fully automated, templated content |
to = your.own@email.com firstBoth actions use the same params: to, subject, body.
A draft gives you one human checkpoint before sending. For advisor emails, one mis-addressed email is worse than the automation saving you. Use draft in development, send only in production.
Create a free account to get started. Paid plans unlock all tracks.