الأكاديمية ← قنوات المراسلةتوثيق رسمي · إرشاد عربي

قناة البريد الإلكتروني

Email

متوسط إلى متقدم6 دقائق قراءةالدرس 115 أسئلة✓ 2026-08-18
قبل أن تقرأ

ما هذه الصفحة، وماذا تحتوي.

بوابة المراسلة: الوصلة التي تجعلك تكلّم Hermes من تطبيق تستعمله أصلًا، مثل Telegram أو WhatsApp، بدل الطرفية. الوكيل الذي تصله من هاتفك تستعمله فعلًا. الذي يحتاج فتح الحاسوب تنساه بعد أسبوع. الصفحة فيها تحذير من المصدر، و6 دقائق قراءة. انتبه: افتح القناة لنفسك فقط في البداية عبر قائمة سماح. القناة المفتوحة تعني أن أي شخص يراسل وكيلك.

8أقسام
4أمثلة برمجية
3جداول
3أوامر
1,026كلمة من المصدر
الوصف الرسمي في سطر

Set up Hermes Agent as an email assistant via IMAP/SMTP

ماذا ستستطيع بعدها

نتائج مأخوذة من هذه الصفحة، لا من قالب.

  • تعرف ما بوابة المراسلة ولماذا قد تحتاجه.
  • تنفّذ hermes gateway install وhermes gateway وتفهم ما يحدث بعدها.
  • تقرأ الجدول وتأخذ منه السطر الذي يخصّك فقط.
  • تضبط EMAIL_ADDRESS في المكان الصحيح.
ما ستقابله من أسماء

كما تظهر تمامًا داخل Hermes.

الأوامر
  • hermes gateway install
  • hermes gateway
  • hermes gateway setup
متغيرات البيئة
  • EMAIL_ADDRESS
  • EMAIL_PASSWORD
  • EMAIL_IMAP_HOST
  • EMAIL_SMTP_HOST
  • EMAIL_ALLOWED_USERS
  • EMAIL_IMAP_PORT
  • EMAIL_SMTP_PORT
  • EMAIL_POLL_INTERVAL
خريطة الصفحة

انتقل مباشرة إلى ما تحتاجه.

  1. 01Prerequisites
  2. 02Step 1: Configure Hermes
  3. 03Step 2: Start the Gateway
  4. 04How It Works
  5. 05Access Control
  6. 06Troubleshooting
  7. 07Security
  8. 08Environment Variables Reference
الصفحة الرسمية كاملة

بلا اختصار أو حذف.

النص أدناه منقول من المصدر الرسمي بالإنجليزية حتى تبقى الأوامر والأسماء دقيقة كما هي. قبل كل قسم شرح عربي يوضّح ما بداخله.

Hermes can receive and reply to emails using standard IMAP and SMTP protocols. Send an email to the agent's address and it replies in-thread — no special client or bot API needed. Works with Gmail, Outlook, Yahoo, Fastmail, or any provider that supports IMAP/SMTP.

This is separate from the bundled Himalaya email skill, which lets the agent manage email through terminal commands and requires the external himalaya CLI plus a Himalaya config file.

Use caseWhat to configureExternal dependency
Let people email the Hermes agent and receive repliesEmail gateway adapter on this pageNone beyond an IMAP/SMTP email account
Let the agent inspect, compose, move, and manage mailbox messages from terminal toolsHimalaya email skillhimalaya CLI and ~/.config/himalaya/config.toml

---

Prerequisites

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه. تذكير: الوصلة التي تجعلك تكلّم Hermes من تطبيق تستعمله أصلًا، مثل Telegram أو WhatsApp، بدل الطرفية.

  • A dedicated email account for your Hermes agent (don't use your personal email)
  • IMAP enabled on the email account
  • An app password if using Gmail or another provider with 2FA

Gmail Setup

  1. Enable 2-Factor Authentication on your Google Account
  2. Go to App Passwords ↗
  3. Create a new App Password (select "Mail" or "Other")
  4. Copy the 16-character password — you'll use this instead of your regular password

Outlook / Microsoft 365

  1. Go to Security Settings ↗
  2. Enable 2FA if not already active
  3. Create an App Password under "Additional security options"
  4. IMAP host: outlook.office365.com, SMTP host: smtp.office365.com

Other Providers

Most email providers support IMAP/SMTP. Check your provider's documentation for:

  • IMAP host and port (usually port 993 with SSL)
  • SMTP host and port (usually port 587 with STARTTLS)
  • Whether app passwords are required

---

Step 1: Configure Hermes

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes gateway setup.

The easiest way:

Shellسطر واحد
hermes gateway setup

Select Email from the platform menu. The wizard prompts for your email address, password, IMAP/SMTP hosts, and allowed senders.

Manual Configuration

Add to ~/.hermes/.env:

Shell14 سطرًا
# Required
EMAIL_ADDRESS=hermes@gmail.com
EMAIL_PASSWORD=abcd efgh ijkl mnop    # App password (not your regular password)
EMAIL_IMAP_HOST=imap.gmail.com
EMAIL_SMTP_HOST=smtp.gmail.com

# Security (recommended)
EMAIL_ALLOWED_USERS=your@email.com,colleague@work.com

# Optional
EMAIL_IMAP_PORT=993                    # Default: 993 (IMAP SSL)
EMAIL_SMTP_PORT=587                    # Default: 587 (SMTP STARTTLS)
EMAIL_POLL_INTERVAL=15                 # Seconds between inbox checks (default: 15)
EMAIL_HOME_ADDRESS=your@email.com      # Default delivery target for cron jobs

---

Step 2: Start the Gateway

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes gateway، hermes gateway install.

Shell3 أسطر
hermes gateway              # Run in foreground
hermes gateway install      # Install as a user service
sudo hermes gateway install --system   # Linux only: boot-time system service

On startup, the adapter:

  1. Tests IMAP and SMTP connections
  2. Marks all existing inbox messages as "seen" (only processes new emails)
  3. Starts polling for new messages

---

How It Works

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير.

Receiving Messages

The adapter polls the IMAP inbox for UNSEEN messages at a configurable interval (default: 15 seconds). For each new email:

  • Subject line is included as context (e.g., [Subject: Deploy to production])
  • Reply emails (subject starting with Re:) skip the subject prefix — the thread context is already established
  • Attachments are cached locally:
  • Images (JPEG, PNG, GIF, WebP) → available to the vision tool
  • Documents (PDF, ZIP, etc.) → available for file access
  • HTML-only emails have tags stripped for plain text extraction
  • Self-messages are filtered out to prevent reply loops
  • Automated/noreply senders are silently ignored — noreply@, mailer-daemon@, bounce@, no-reply@, and emails with Auto-Submitted, Precedence: bulk, or List-Unsubscribe headers

Sending Replies

Replies are sent via SMTP with proper email threading:

  • In-Reply-To and References headers maintain the thread
  • Subject line preserved with Re: prefix (no double Re: Re:)
  • Message-ID generated with the agent's domain
  • Responses are sent as plain text (UTF-8)

File Attachments

The agent can send file attachments in replies. Include MEDIA:/path/to/file in the response and the file is attached to the outgoing email.

Skipping Attachments

To ignore all incoming attachments (for malware protection or bandwidth savings), add to your config.yaml:

YAML3 أسطر
platforms:
  email:
    skip_attachments: true

When enabled, attachment and inline parts are skipped before payload decoding. The email body text is still processed normally.

---

Access Control

فيه تحذير مهم. اقرأه قبل أن تنفّذ أي شيء من هذا القسم. نصّ التحذير من المصدر مذكور أسفل هذا الشرح.

Email access is stricter by default than chat-style platforms:

  1. EMAIL_ALLOWED_USERS set → only emails from those addresses are processed
  2. No allowlist set → unknown senders are ignored silently
  3. EMAIL_ALLOW_ALL_USERS=true → any sender is accepted (use with caution)
  4. platforms.email.unauthorized_dm_behavior: pair → unknown senders receive a pairing code

---

Troubleshooting

قسم لحل المشكلات. ابحث فيه عن العطل الذي يشبه حالتك بدل قراءته كاملًا.

ProblemSolution
"IMAP connection failed" at startupVerify EMAIL_IMAP_HOST and EMAIL_IMAP_PORT. Ensure IMAP is enabled on the account. For Gmail, enable it in Settings → Forwarding and POP/IMAP.
"SMTP connection failed" at startupVerify EMAIL_SMTP_HOST and EMAIL_SMTP_PORT. Check that your password is correct (use App Password for Gmail).
Messages not receivedCheck EMAIL_ALLOWED_USERS includes the sender's email. Check spam folder — some providers flag automated replies.
"Authentication failed"For Gmail, you must use an App Password, not your regular password. Ensure 2FA is enabled first.
Duplicate repliesEnsure only one gateway instance is running. Check hermes gateway status.
Slow responseThe default poll interval is 15 seconds. Reduce with EMAIL_POLL_INTERVAL=5 for faster response (but more IMAP connections).
Replies not threadingThe adapter uses In-Reply-To headers. Some email clients (especially web-based) may not thread correctly with automated messages.

---

Security

فيه تحذير مهم. اقرأه قبل أن تنفّذ أي شيء من هذا القسم. نصّ التحذير من المصدر مذكور أسفل هذا الشرح.

  • Use App Passwords instead of your main password (required for Gmail with 2FA)
  • Set EMAIL_ALLOWED_USERS to restrict who can interact with the agent
  • The password is stored in ~/.hermes/.env — protect this file (chmod 600)
  • IMAP uses SSL (port 993) and SMTP uses STARTTLS (port 587) by default — connections are encrypted

---

Environment Variables Reference

جدول مرجعي. لا تقرأه كله، ابحث عن السطر الذي يخصّك فقط.

VariableRequiredDefaultDescription
EMAIL_ADDRESSYes—Agent's email address
EMAIL_PASSWORDYes—Email password or app password
EMAIL_IMAP_HOSTYes—IMAP server host (e.g., imap.gmail.com)
EMAIL_SMTP_HOSTYes—SMTP server host (e.g., smtp.gmail.com)
EMAIL_IMAP_PORTNo993IMAP server port
EMAIL_SMTP_PORTNo587SMTP server port
EMAIL_POLL_INTERVALNo15Seconds between inbox checks
EMAIL_ALLOWED_USERSNo—Comma-separated allowed sender addresses
EMAIL_HOME_ADDRESSNo—Default delivery target for cron jobs
EMAIL_ALLOW_ALL_USERSNofalseAllow all senders (not recommended)
اختبار الفهم

5 أسئلة إجاباتها كلها في هذه الصفحة.

كل خيار اسم حقيقي من توثيق Hermes. حتى الخيارات الخاطئة حقيقية، لكنها من صفحات أخرى.

1. بحسب هذا الدرس، أي أمر يقوم بـ«Run in foreground»؟
2. بحسب هذا الدرس، أي أمر يقوم بـ«Install as a user service»؟
3. في جدول هذا الدرس، ما «Solution» المقابل لـ«Messages not received»؟
4. أي متغير بيئة من التالي يظهر فعليًا في هذا الدرس؟
5. ما التحذير الذي يذكره المصدر في هذا الدرس؟