System Overview
Requirements
- PHP 7.4+
- MySQL 5.7+ / MariaDB 10.2+
- cPanel with email piping
- Domain with email hosting
Email Method
⚡ Email Piping (Real-time)
Email langsung di-pipe ke PHP script - instant tanpa delay!
File Structure
📦 public_html/
├── api.php
├── config.php
├── install.php
├── mail-receiver.php
├── cleanup.php
└── temp-email.php
Configuration
Edit config.php:
Database
define(
'DB_HOST',
'localhost'
);
define(
'DB_NAME',
'tempmail'
);
define(
'DB_USER',
'YOUR_USERNAME'
);
define(
'DB_PASS',
'YOUR_PASSWORD'
);
Single Domain
define(
'EMAIL_DOMAIN',
'yourdomain.com'
);
define(
'ALLOWED_DOMAINS',
[
'yourdomain.com'
]
);
Multiple Domain (Optional)
define(
'EMAIL_DOMAIN',
'suksma.id'
);
define(
'ALLOWED_DOMAINS',
[
'suksma.id',
'tempmail.net',
'disposable.email'
]
);
💡 Multiple Domain
Setup piping untuk setiap domain. Satu script handle semua domain.
Config Reference
| Constant | Description | Example |
DB_HOST | Database host | localhost |
DB_NAME | Database name | tempmail |
DB_USER | DB username | user_tempmail |
EMAIL_DOMAIN | Default domain | suksma.id |
Setup Email Piping
Configure Default Address
- Login ke cPanel
- Buka Default Address
- Pilih domain (e.g., suksma.id)
- Action: Pipe to a Program
- Path:
usr/bin/php public_html/mail-receiver.php
- Save/Change
✅ What This Does
Email ke *@domain.com langsung masuk ke mail-receiver.php real-time!
Multiple Domain
Ulangi untuk setiap domain:
Default Address → Pipe to a Program
Path: usr/bin/php public_html/mail-receiver.php
Default Address → Pipe to a Program
Path: usr/bin/php public_html/mail-receiver.php
Default Address → Pipe to a Program
Path: usr/bin/php public_html/mail-receiver.php
💡 Path Options
Relative: usr/bin/php public_html/mail-receiver.php
Absolute: /usr/bin/php /home/user/public_html/mail-receiver.php
Cron Job (Cleanup Only)
📌 Note
Email sudah real-time via piping. Cron hanya untuk cleanup.
Setup
- cPanel → Cron Jobs
- Once Per Day (0 2 * * *)
- Runs at 2 AM daily
Command (PHP)
0 2 * * * /usr/bin/php /home/USERNAME/public_html/cleanup.php
⚠️ Replace
Ganti USERNAME dengan cPanel username
Alternative (wget)
0 2 * * * wget -q -O - https://yourdomain.com/cleanup.php >/dev/null 2>&1
Testing
1. Web Interface
Akses: https://yourdomain.com/temp-email.php
- Klik "✨ New"
- Email muncul (e.g., budipratama123@domain.com)
2. Custom Email
- Centang "🎯 Custom Email Name"
- Ketik: testuser
- Klik "✨ New"
- Result: testuser@domain.com
3. Email Receiving
- Kirim email dari Gmail
- Email masuk INSTANT
- Refresh inbox
- Email tampil!
4. API Test
curl https://yourdomain.com/api.php/generate
{
"success": true,
"email": "budipratama123@suksma.id",
"username": "budipratama123",
"domain": "suksma.id",
"expires_at": "2026-01-25 15:30:00"
}
curl https://yourdomain.com/api.php/generate?username=testuser
{
"success": true,
"email": "testuser@suksma.id",
"username": "testuser",
"domain": "suksma.id",
"expires_at": "2026-01-25 15:30:00"
}
✅ All Pass?
Selamat! TempMail berhasil terinstall!
Troubleshooting
- Check DB_USER, DB_PASS di config.php
- Verify database exists di cPanel
- Check user privileges (ALL)
- Check Default Address di cPanel (piping set?)
- Verify path mail-receiver.php benar
- Check permissions:
chmod 755 mail-receiver.php
- Lihat error_log di cPanel
Username 'admin', 'info', 'root' dll di-block.
Gunakan username lain atau edit list di api.php
- Check PHP path:
which php
- Gunakan absolute path
- Test manual:
php cleanup.php
- Alternative: wget/curl method
Debug Mode
error_reporting(
E_ALL
);
ini_set(
'display_errors',
1
);
ini_set(
'log_errors',
1
);
ini_set(
'error_log',
'/path/to/error.log'
);
⚠️ Disable di production!
Set display_errors = 0 setelah development selesai