← 返回
未分类 Key

ews-exchange

Read, search, and send emails via EWS (Exchange Web Services) for Microsoft Exchange On-Premise. Uses HTTPS + NTLM authentication. Supports reading inbox, fetching full email content, sending emails with attachments, and listing mailbox folders.
Read, search, and send emails via EWS (Exchange Web Services) for Microsoft Exchange On-Premise. Uses HTTPS + NTLM authentication. Supports reading inbox, fetching full email content, sending emails with attachments, and listing mailbox folders.
user_5e0cbb96
未分类 community v1.0.0 1 版本 97826.1 Key: 需要
★ 0
Stars
📥 45
下载
💾 0
安装
1
版本
#latest

概述

EWS Exchange Email

Read, search, and send emails via EWS (Exchange Web Services) for Microsoft Exchange On-Premise.

Uses HTTPS (port 443) + NTLM authentication — works even when IMAP/SMTP ports are firewalled.

Configuration

Config is stored at ~/.config/ews-exchange/.env.

Setup

pip install requests requests_ntlm

Config file format

# Required
EWS_URL=https://mail.your-company.com/EWS/Exchange.asmx
EWS_DOMAIN=YOUR_AD_DOMAIN
EWS_USER=you@your-company.com
EWS_PASS=your_password
EWS_FROM=you@your-company.com

# Optional
EWS_VERIFY_SSL=false   # Set to false for self-signed certs (default: false)

Important for Exchange On-Premise:

  • EWS_DOMAIN is your Active Directory domain (e.g. UCH), NOT the email domain
  • Self-signed certificates are common — set EWS_VERIFY_SSL=false
  • Find your EWS URL via Autodiscover: https://autodiscover.your-company.com/Autodiscover/Autodiscover.xml

Multi-Account

Add prefixed variables for additional accounts:

# Work account (WORK_ prefix)
WORK_EWS_URL=https://mail.company.com/EWS/Exchange.asmx
WORK_EWS_DOMAIN=COMPANY
WORK_EWS_USER=me@company.com
WORK_EWS_PASS=password
WORK_EWS_FROM=me@company.com

Use --account before any command:

python scripts/ews.py --account work check

Commands

test

Test EWS connection and authentication.

python scripts/ews.py [--account <name>] test

check

Check latest emails.

python scripts/ews.py [--account <name>] check [--limit 10] [--folder inbox] [--recent 2h] [--unread]

Options:

  • --limit : Max results (default: 10)
  • --folder : Mailbox folder (default: inbox)
  • --recent : Only show emails from last X time (e.g. 30m, 2h, 7d)
  • --unread: Only show unread emails

fetch

Fetch full email content by index number (from check output) or UID.

python scripts/ews.py [--account <name>] fetch <index_or_uid> [--folder inbox]

Options:

  • --folder : Mailbox (default: inbox)

send

Send email via EWS.

python scripts/ews.py [--account <name>] send --to <email> --subject <text> [options]

Required:

  • --to : Recipient (comma-separated for multiple)
  • --subject : Email subject

Optional:

  • --body : Plain text body
  • --html: Send body as HTML
  • --body-file : Read body from file
  • --cc : CC recipients
  • --bcc : BCC recipients
  • --attach : Attachments (comma-separated)
  • --from : Override default sender

Examples:

# Simple text email
python scripts/ews.py send --to recipient@example.com --subject "Hello" --body "World"

# HTML email
python scripts/ews.py send --to recipient@example.com --subject "Newsletter" --html --body "<h1>Welcome</h1>"

# Email with attachment
python scripts/ews.py send --to recipient@example.com --subject "Report" --body "Please find attached" --attach report.pdf

search

Search emails with filters.

python scripts/ews.py [--account <name>] search [options]

Options:

  • --unseen: Only unread messages
  • --from : From address contains
  • --subject : Subject contains
  • --recent : From last X time (e.g. 30m, 2h, 7d)
  • --limit : Max results (default: 20)
  • --folder : Mailbox to search (default: inbox)

folders

List all mailbox folders.

python scripts/ews.py [--account <name>] folders

list-accounts

List all configured email accounts.

python scripts/ews.py list-accounts

Common Exchange Folder IDs

Folder IDName
-----------------
inboxInbox
sentitemsSent Items
draftsDrafts
deleteditemsDeleted Items
junkemailJunk Email
outboxOutbox
archiveinboxArchive Inbox

Troubleshooting

Authentication failed (401):

  • Verify EWS_DOMAIN is your AD domain (e.g. UCH), not email domain
  • Try different domain names if unsure
  • Check username format: usually user@domain.com or just username

HTTP 500 / Invalid Request:

  • EWS endpoint URL may be wrong — check via Autodiscover
  • Some Exchange versions need specific RequestServerVersion

SSL/TLS errors:

  • Set EWS_VERIFY_SSL=false for self-signed certificates (common on-prem)

Connection timeout:

  • Verify port 443 is open: telnet mail.company.com 443
  • Check if you're on the correct network/VPN

版本历史

共 1 个版本

  • v1.0.0 Initial release 当前
    2026-05-28 10:26 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误和纠正,以实现持续改进。使用时机:(1)命令或操作意外失败;(2)用户纠正……
★ 4,058 📥 797,759
security-compliance

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,212 📥 266,360
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,353 📥 317,940