# Ladell Outreach gateway for cPanel

This package contains the gateway source and a private configuration template. Composer installs PHPMailer on the server. The package contains no credentials and does not send anything when opened in a browser.

## Install

1. Use an SMTP provider that permits your intended outreach. Confirm that your cPanel subdomain resolves publicly and has a valid HTTPS certificate.
2. In cPanel File Manager, open the subdomain's document root and upload only `public/send.php`. For example, the proposed URL is `https://outreach-mail.ladellentertainment.com/send.php`.
3. Put the `ladell-outreach-private` folder outside every public document root. By default, `send.php` looks for it beside the subdomain's document-root folder. For example, if the document root is `/home/USERNAME/outreach-mail`, the default private folder is `/home/USERNAME/ladell-outreach-private`. If your layout differs, configure `LADELL_OUTREACH_PRIVATE_DIR` with the absolute private path in your PHP environment. Never use a directory inside `public_html` for the private configuration.
4. Inside the private folder, copy `config.example.php` to `config.php`. Enter the same secret currently saved as `OUTREACH_MAIL_TOKEN` in Ladell and the SMTP password for `services@ladellentertainment.com`. Keep the configured SMTP hostname if it matches your provider's secure SMTP instructions. The gateway is configured for SSL/TLS on port 465. Make the private folder and files readable only by your hosting account and its PHP process.
5. In cPanel Terminal or SSH, enter the private folder and run:

   ```sh
   composer install --no-dev --prefer-dist
   mkdir -m 700 -p receipts
   chmod 600 config.php
   ```

   If the host offers no Terminal or Composer, install the dependencies with Composer locally using a compatible PHP version, then upload the generated `vendor` directory to the private folder. The web PHP process needs write access to `receipts`.
6. Visit `send.php` over HTTPS. An installed endpoint should return HTTP 405 and `{"error":"Use POST."}`. An HTTPS POST without an authorization token should return 401 once the private config is in place. These checks do not send email.
7. After the Ladell send connector is ready for testing, the endpoint URL is the value for `OUTREACH_MAIL_URL`. Test with an inbox you control before enabling prospect delivery. Repeating a successful request with the same message and idempotency key must return the same receipt without sending a second copy.

## Delivery receipts

The gateway authenticates the request, accepts a single recipient, submits the email via SMTP, and returns the original Message-ID after acceptance. Keep the `receipts` directory durable. If the gateway cannot determine whether SMTP accepted a message, it preserves the claim and blocks resending the same mail. Check the SMTP logs or recipient inbox before clearing any unresolved claim.
