Email notification system for OpenIPC cameras with SMTP support and web interface integration.
This package provides email notification capabilities for OpenIPC IP cameras, allowing you to send snapshots and alerts via email. It includes:
- mail-send - Lightweight CLI tool to send emails with attachments via SMTP
- mail - Shell wrapper script for OpenIPC integration
- ext-mail.cgi - Web interface for configuration and remote triggering
- Send emails with text body and/or file attachments
- SMTP authentication with STARTTLS support
- Automatic SMTP host detection from email domain
- Multiple file attachments support
- Automatic MIME type detection
- Snapshot attachments in JPEG or HEIF format
- Scheduled email notifications via crontab
- Web interface for easy configuration
- Webhook support for remote triggering
- Template placeholders for dynamic content
Download and install the latest release:
VERSION=0.1
curl -sL https://github.com/yamixst/openipc-mail-send/releases/download/v${VERSION}/openipc-mail-send-${VERSION}.tar.gz | \
gunzip | tar x -C /tmp && \
/tmp/openipc-mail-send-${VERSION}/install.sh && \
rm -rf /tmp/openipc-mail-send-${VERSION}- Download the release package
- Extract to a temporary directory
- Run
install.sh
The installer will:
- Copy
mail-sendandmailto/usr/bin/ - Install configuration file to
/etc/webui/mail.conf - Add CGI script to
/var/www/cgi-bin/ - Add Mail menu to the web interface
Edit /etc/webui/mail.conf to configure your mail settings:
# Enable/disable mail notifications
mail_enabled="true"
# Sender mail address (required)
mail_from="camera@example.com"
# Recipient mail address (required)
mail_to="alerts@example.com"
# SMTP authentication password (required)
# For Gmail, use App Password: https://support.google.com/accounts/answer/185833
mail_password="your_smtp_password"
# Mail subject (optional)
# Placeholders: %hostname, %datetime, %soctemp
mail_subject="Alert from %hostname at %datetime"
# Mail body text (optional)
# Placeholders: %hostname, %datetime, %soctemp
mail_body="Camera %hostname captured a snapshot at %datetime. Temperature: %soctemp C"
# SMTP authentication username (optional, defaults to mail_from)
#mail_user="smtp_username"
# SMTP server host (optional, auto-detected from mail domain)
#mail_smtp_host="smtp.gmail.com"
# SMTP server port (optional, default: 587)
#mail_smtp_port="587"
# Send snapshot as HEIF instead of JPEG (optional, requires h265 codec)
#mail_heif="false"The following placeholders can be used in mail_subject and mail_body:
| Placeholder | Description |
|---|---|
%hostname |
Camera hostname |
%datetime |
Current date and time |
%soctemp |
SoC temperature |
Send a snapshot manually:
/usr/bin/mailAccess the Mail configuration page at:
http://CAMERA_IP/cgi-bin/ext-mail.cgi
Trigger email sending remotely via HTTP:
http://root:password@CAMERA_IP/cgi-bin/ext-mail.cgi?send=image
Returns true on success, false on failure.
Enable crontab in the web interface to send snapshots at regular intervals.
The mail-send utility can be used standalone:
mail-send [OPTIONS]
| Option | Description |
|---|---|
-f, --from <FROM> |
Sender email address |
-t, --to <TO> |
Recipient email address |
-s, --subject <SUBJECT> |
Email subject |
-p, --password <PASSWORD> |
SMTP authentication password |
| Option | Description |
|---|---|
-b, --body <BODY> |
Email body text |
-a, --attach <FILE> |
Path to file to attach (can be repeated) |
-u, --user <USER> |
SMTP auth username (defaults to FROM) |
--smtp-host <HOST> |
SMTP server host (auto-detected from domain) |
--smtp-port <PORT> |
SMTP server port (default: 587) |
-h, --help |
Show help message |
Note: At least one of --body or --attach must be specified.
Send a simple email:
mail-send \
-f user@gmail.com \
-t recipient@example.com \
-s "Hello" \
-b "This is the message body" \
-p "your-app-password"Send an email with attachment:
mail-send \
-f user@gmail.com \
-t recipient@example.com \
-s "Photo from camera" \
-a /tmp/snapshot.jpg \
-p "your-app-password"Send with multiple attachments:
mail-send \
-f user@gmail.com \
-t recipient@example.com \
-s "Multiple files" \
-b "See attached files" \
-a /tmp/file1.jpg \
-a /tmp/file2.pdf \
-p "your-app-password"If --smtp-host is not specified, the SMTP host is automatically derived from the sender's email domain:
user@gmail.com→smtp.gmail.comuser@outlook.com→smtp.outlook.comuser@mail.ru→smtp.mail.ru
For Gmail, you need to use an App Password:
- Enable 2-Factor Authentication on your Google Account
- Go to Google App Passwords
- Create a new App Password for "Mail"
- Use the generated 16-character password
| Provider | SMTP Host | Port |
|---|---|---|
| Gmail | smtp.gmail.com | 587 |
| Outlook/Hotmail | smtp.office365.com | 587 |
| Yahoo | smtp.mail.yahoo.com | 587 |
| Mail.ru | smtp.mail.ru | 587 |
| Yandex | smtp.yandex.ru | 587 |
openipc-mail-send/
├── mail-send # Shell script implementation
├── mail-send-rs/ # Rust implementation (optional)
│ ├── src/
│ ├── Cargo.toml
│ └── docker-build.sh
├── openipc/
│ ├── mail # OpenIPC wrapper script
│ ├── mail.conf.example # Configuration template
│ ├── ext-mail.cgi # Web interface CGI
│ └── add-mail-menu.sh # Menu installation script
├── build-package.sh # Package build script
└── README.md
VERSION=0.1 ./build-package.shCreates openipc-mail-send-0.1.tar.gz package.
The project includes a Rust implementation for better performance:
cd mail-send-rs
./docker-build.shThe tool automatically detects MIME types for common file extensions:
- Images: JPEG, PNG, GIF, WebP, HEIF/HEIC
- Documents: PDF, TXT, HTML
- Video: MP4, AVI, MKV
- Audio: MP3, WAV
- Archives: ZIP, TAR, GZIP
- OpenIPC firmware with web interface
curlwith SSL supportbase64oropensslfor encoding attachments
Part of the OpenIPC project.