> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ahmadraza.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Tinker

### Testing Mail Functionality in Laravel

1. **Navigate to Your Project Directory:**
   Change to the directory where your Laravel project is located.
   ```bash theme={null}
   cd /path/to/your/laravel/project
   ```

2. **Enter Laravel Tinker:**
   Laravel Tinker provides an interactive REPL for your application. Use it to run commands and test functionality.
   ```bash theme={null}
   php artisan tinker
   ```

3. **Send a Test Email:**
   Once inside Tinker, you can use the `Mail` facade to send a test email. Replace `myemail@gmail.com` with the email address you want to send the test email to.
   ```php theme={null}
   Mail::raw('Hello World!', function($msg) {
       $msg->to('myemail@gmail.com')->subject('Test Email');
   });
   ```

### Additional Tips

* **Configuration Check:** Ensure your mail configuration is correctly set up in `.env` file. For example:
  ```env theme={null}
  MAIL_MAILER=smtp
  MAIL_HOST=smtp.example.com
  MAIL_PORT=587
  MAIL_USERNAME=your_username
  MAIL_PASSWORD=your_password
  MAIL_ENCRYPTION=tls
  MAIL_FROM_ADDRESS=no-reply@example.com
  MAIL_FROM_NAME="${APP_NAME}"
  ```

* **Testing Locally:** If you’re testing locally, you might want to use a tool like [Mailtrap](https://mailtrap.io/) for catching outgoing emails without actually sending them to real addresses.

* **Logs and Errors:** Check your Laravel log files (`storage/logs/laravel.log`) if you encounter issues or errors during the email sending process.

> This approach is useful for quickly verifying that your email setup is working as expected within your Laravel application.
