# MailPilot deployment

This version separates SMTP profiles from general settings. SMTP passwords are encrypted by Laravel's `encrypted` cast. Set `APP_KEY` before saving profiles and do not upload `.env` or commit it.

## Environment

Copy `.env.example` to `.env` and set the production database values, a strong `APP_KEY`, a numeric `SENDER_PIN`, and a long random `SMTP_SETTINGS_PASSPHRASE`. The PIN unlocks the sender dashboard. The passphrase protects SMTP-profile and template changes.

The default Reply-To is `support@greatglen.online`. The default message explains that the purpose is to identify businesses seeking funding and asks interested recipients to reply with `INTERESTED`. Each profile can override it. For Spacemail, use the SMTP host shown in its mailbox settings, normally `mail.spacemail.com`, port `465`, and SSL. For providers that document STARTTLS, use port `587` and TLS. Zoho may require an application-specific password when two-factor authentication is enabled.

## Database

Preferred command:

```bash
php artisan migrate --force
```

If the host cannot run migrations, review and run `database/sql/upgrade.sql` against the same database. The SQL file is intended for a pre-upgrade schema; do not run it twice.

## Cron

Install exactly one scheduler entry. Run it every minute; Laravel decides whether a message is due, whether the profile is pacing, and whether a cooldown is active.

```cron
* * * * * cd /home/npspzdyalc/greatgleninc.com/email-marketing && /usr/local/bin/php artisan schedule:run >> /home/npspzdyalc/greatgleninc.com/email-marketing/storage/logs/cron.log 2>&1
```

## Conservative defaults

New profiles default to **500 messages per rolling hour** and a **10-second delay** between messages for paid Spacemail. The sender rotates only between enabled SMTP profiles whose own quota, cooldown, and pacing rules allow the next send. Spacemail's terms say aliases do not increase a mailbox quota, so aliases are never treated as separate senders. Provider anti-abuse throttling may still defer messages.

A provider rate-limit response does not unsubscribe a recipient. The profile enters a one-hour cooldown and the recipient is scheduled for a later retry. Only an explicit unsubscribe or a recognizable permanent mailbox rejection suppresses a recipient.

## Deliverability

Inbox placement cannot be guaranteed by application code. Configure SPF, DKIM, and DMARC for every sending domain, use an accurate From address, keep the plain-text alternative, and send only to contacts who can lawfully be contacted. The template includes a one-click unsubscribe URL and supports a `remove` reply process that should be handled operationally.

Sources:

- https://www.spaceship.com/knowledgebase/spacemail-email-limits/
- https://www.spaceship.com/legal/spacemail/
- https://www.spaceship.com/knowledgebase/outgoing-emails-marked-as-spam/
- https://www.zoho.com/mail/help/zoho-smtp.html
