You can accept email list subscriptions coming from external sites by adding a subscription form to that site.
In order to accept incoming form subscriptions you must set
allow_form_subscriptions to true.
$emailList->update(['allow_form_subscriptions' => true]);
Here's an example form you can embed on an external site to accept subscriptions.
<form method="POST" action="https://domain-where-mailcoach-runs/mailcoach/subscribe/<uuid-of-emaillist>">
<input type="hidden" name="redirect_after_subscribed" value="https://your-site/subscribed" />
<input type="hidden" name="redirect_after_already_subscribed" value="https://your-site/already-subscribed" />
You can specify one or more tags in an input field named
tags that should be attached to the subscriber when it gets created.
<input type="hidden" name="tags" value="tagA;tagB">
Only tags that were added on the
allowedFormSubscriptionTags relation of the email list you're subscribing someone to will be attached. Here's you can attach tags to that relation.
$tagA = $emailList->tags()->where('name', 'tagA')->first();
$tagB = $emailList->tags()->where('name', 'tagB')->first();
A word to the wise
We highly recommend that you turn on confirmation for email lists that allow form subscriptions. This will keep your list healthy. Also consider adding a honeypot to the form to avoid bots from trying to subscribe. When using Laravel, you could opt to use the spatie/laravel-honeypot package.