BuiltEmail workspace

Affiliate account confirmation

Source: App\Mail\AffiliateAccountCreated, app/Mail/AffiliateAccountCreated.php, resources/views/emails/affiliateAccount.blade.php. Shared original components: mail::message, mail::promotion and mail::subcopy. Static usage evidence is not proof of current production delivery.

Native subject: Affiliate Account Created. No explicit subject override exists; Laravel derives this from the class basename. Preserve the native behavior. Suggested preheader: Your affiliate account has been created. Copy and share your referral link.

Required portable values

TokenExisting source / derivationHandling
{{affiliate_name}}account.nameEscaped new affiliate's name in greeting. Not a referred recipient or business identity.
{{referral_url}}'https://affiliate.builtaccounting.com/' . account.codeRequired complete share URL; retain the original code as text, including case and leading zeros. Validate the approved HTTPS host/path separately and escape text. Do not replace with the app dashboard, account ID, a guessed signup path or another affiliate.
{{app_name}}config('app.name')Escaped original Thanks sign-off.
{{preheader}}Suggested existing creation/sharing summary aboveEscaped text; no payout or approval claim.

The default Built logo is concrete HTTPS. Optional {{logo_url}} override and shared footer PNG/CID requirements follow [shared-footer](../shared-footer.md). There are no optional business sections. Missing required name/code/URL needs an explicit adapter decision; no guessed link or affiliate record. The full referral_url explicitly maps account.code, so no separate displayed code token is needed.

Trigger, recipient and native delivery

AffiliateAccountController::store, app/Http/Controllers/Account/AffiliateAccountController.php:57–124, validates required signup fields including request.email as email. It checks for existing account by current API user's ID or requested email, saves the new AffiliateAccount with generated code, updates an available user is_affiliate flag, then calls Mail::to(request.email)->send(new AffiliateAccountCreated(account)) at :104. Existing-account rejection and native error handling remain unchanged. Do not infer that an existing account gets another confirmation or change code generation through HTML.

routes/api.php has affiliateaccount POST registrations around :1239 and :1476; retain existing route/authentication behavior. From/Reply-To are not explicitly overridden by this Mailable. Preserve configured headers, native subject and send(); Queueable does not turn this call into queue(). Underlying transport/outbox can still be asynchronous. No PDF or business attachment is configured.

Sharing rather than signing up

The original source prints the referral URL as text and explicitly tells the affiliate to copy/share it and NOT sign up through it themselves. Keep that warning inside HTML and plain text. The draft deliberately has no signup button and presents a selectable text URL; some email clients can auto-link text, so the warning remains essential. No JavaScript/copy button or invented dashboard action belongs in the sendable document.

Original earning context is retained as “You can earn by referring people to Built through your affiliate link.” It does not promise payment on every signup, an amount, commission rate, settlement speed or automatic payout. AppSubscriptionsController's affiliate subscription recording is separate business logic, not evidence of a guaranteed signup payment. No bank, payout or account-number fields from AffiliateAccount belong in this email contract.

There are no legacy duplicate link fields: one source URL contains the affiliate code. Three fictional states cover standard data, supplied code 0 as a rendering check and long name/URL. Code 0 does not claim the generator normally emits that value.

Integration and safety

Use the existing Mailable with a complete HTML Blade view and proposed plain-text alternative. Portable {{placeholder_name}} tokens are not automatically Blade expressions. Do not nest the full document inside mail::message or introduce another framework. Escape dynamic values/attributes, validate the share URL and logo/CID separately, and use one pass for string replacements so inserted token-shaped text stays literal.

Files: public/ready/affiliate-account-created.html/.txt and previews/affiliate-account-created-*.html/.txt. No separate project-owned plain-text source found; new text is proposed equivalent content. Use actual matching CID attachments or approved absolute HTTPS assets for shared badges. Local preview URLs are inert stand-ins, never production destinations. Browser checks do not prove external referral-site behavior, payouts, Gmail/Outlook/iOS Mail, image delivery or current production sending.