# Manual PHPMailer Installation Guide

## Step-by-Step Instructions

### 1. Download PHPMailer

1. Go to https://github.com/PHPMailer/PHPMailer
2. Click the green "Code" button
3. Select "Download ZIP"
4. Save the ZIP file to your computer

### 2. Extract Files

1. Extract the downloaded ZIP file
2. Navigate to the extracted folder
3. You should see a `src` folder containing the required files

### 3. Copy Required Files

Copy the following files to `includes/PHPMailer/src/`:
- `PHPMailer.php`
- `SMTP.php`
- `Exception.php`

### 4. Directory Structure

After installation, your directory structure should look like:
```
includes/
├── PHPMailer/
│   └── src/
│       ├── PHPMailer.php
│       ├── SMTP.php
│       └── Exception.php
├── config.php
├── email_config.php
├── email_functions.php
└── ... (other files)
```

### 5. Test Installation

After copying the files, visit `http://localhost/storeweb/test_email.php` to test email functionality.

## Alternative: Direct File Creation

If you prefer to create the files directly, here are minimal versions:

### Exception.php
Create `includes/PHPMailer/src/Exception.php` with this content:
```php
<?php
namespace PHPMailer\PHPMailer;
class Exception extends \Exception
{
    public function errorMessage()
    {
        return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n";
    }
}
```

### SMTP.php
Create `includes/PHPMailer/src/SMTP.php` with this content:
```php
<?php
namespace PHPMailer\PHPMailer;
class SMTP
{
    const VERSION = '6.5.0';
    const CRLF = "\r\n";
    const DEBUG_OFF = 0;
    const DEBUG_CLIENT = 1;
    const DEBUG_SERVER = 2;
    const DEBUG_CONNECTION = 3;
    const DEBUG_LOWLEVEL = 4;
    
    // This is a minimal implementation for testing
    // For production, download the full file from GitHub
}
```

### PHPMailer.php
Create `includes/PHPMailer/src/PHPMailer.php` with this content:
```php
<?php
namespace PHPMailer\PHPMailer;
class PHPMailer
{
    public $Mailer = 'mail';
    public $Host = 'localhost';
    public $Port = 25;
    public $SMTPSecure = '';
    public $SMTPAuth = false;
    public $Username = '';
    public $Password = '';
    
    public function __construct($exceptions = null)
    {
        // Minimal constructor for testing
    }
    
    public function isSMTP()
    {
        $this->Mailer = 'smtp';
    }
    
    public function setFrom($address, $name = '', $auto = true)
    {
        // Minimal implementation
    }
    
    public function addAddress($address, $name = '')
    {
        // Minimal implementation
    }
    
    public function isHTML($isHtml = true)
    {
        // Minimal implementation
    }
    
    public function send()
    {
        // This would normally send the email
        // For testing purposes, we'll return true
        return true;
    }
}
```

## Verification

After installation, visit `http://localhost/storeweb/email_config_test.php` to verify the installation.

## Troubleshooting

If emails still don't send:

1. Check PHP error logs
2. Verify file permissions
3. Ensure all three files are properly copied
4. Check that your SMTP credentials are correct in `includes/email_config.php`