Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/email_assistant/tools/gmail/gmail_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,13 @@ def send_email(
subject = "Response"
original_from = "recipient@example.com" # Will be overridden by user input
thread_id = None

# Parse the email address from the From header (which may contain name)
parsed_from = email.utils.parseaddr(original_from)[1] # Extract just the email address

# Create a message object
msg = MIMEText(response_text)
msg["to"] = original_from
msg["to"] = parsed_from
msg["from"] = email_address
msg["subject"] = subject

Expand Down Expand Up @@ -943,4 +946,4 @@ def mark_as_read(
service = build("gmail", "v1", credentials=creds)
service.users().messages().modify(
userId="me", id=message_id, body={"removeLabelIds": ["UNREAD"]}
).execute()
).execute()