# cPanel Setup Instructions for @FakeMailBot

Follow these steps to deploy the Fake Mail Bot on your cPanel account.

---

## 1. File Upload
Upload all files (`bot.php`, `config.php`, `parse_mail.php`) to a directory on your cPanel server. 
* E.g., `/public_html/fakemail/` or a separate subdomain root folder `/public_html/mail/`.

---

## 2. Set Up the SQLite Database Permission
Make sure the folder containing your script has write permissions (`0755` or `0777`) so that PHP can automatically create and modify the database file (`bot.db`) when users start using the bot.

---

## 3. Create the Mail Subdomain in cPanel
1. Open your cPanel dashboard.
2. Search for and open **Subdomains** (or **Domains** in newer cPanel layouts).
3. Create the subdomain you chose: `mail.battlegrounds-hub.xyz`.
4. Point its document root to the folder containing your scripts (e.g. `/public_html/mail`).

---

## 4. Set Up Catch-All Routing in cPanel
To forward all incoming emails sent to your subdomain to our parser script:
1. Search for **Default Address** in cPanel.
2. Select the domain: `mail.battlegrounds-hub.xyz` from the dropdown list.
3. Under the **"Advanced Options"** section, select **Pipe to a Program**.
4. In the text box, enter the full path to your PHP executable followed by the path of `parse_mail.php`.
   - Usually, it is:
     ```bash
     /usr/bin/php -q /home/YOUR_CPANEL_USERNAME/public_html/mail/parse_mail.php
     ```
     *(Be sure to replace `YOUR_CPANEL_USERNAME` with your actual cPanel username. You can find this on the right-hand panel of your cPanel homepage.)*
5. Click **Change**.

---

## 5. Configure your Telegram Bot Token
1. Your token is already set up in the `config.php` file you created!
2. If your subdomain name differs from `mail.battlegrounds-hub.xyz`, edit the `MAIL_DOMAIN` constant in `config.php` to match.

---

## 6. Set Up the Webhook
Telegram needs to know where to send messages when users interact with your bot. To do this, open your browser and click/navigate to the following URL:
```url
https://api.telegram.org/bot8835597643:AAEpHP-CbFdkCTZkZIxa0vsPFyampfndKBg/setWebhook?url=https://mail.battlegrounds-hub.xyz/bot.php
```

Once you see:
```json
{
  "ok": true,
  "result": true,
  "description": "Webhook was set"
}
```
your bot is fully active and ready to test! Run `/start` in your bot to begin.
