PHP code example of siberfx / mail-sdk-kerioconnect
1. Go to this page and download the library: Download siberfx/mail-sdk-kerioconnect library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
siberfx / mail-sdk-kerioconnect example snippets
use Siberfx\MailSdkKerioConnect\Contracts\MailboxProvisioner;
use Siberfx\MailSdkKerioConnect\Contracts\MailTransport;
final class OnboardTenant
{
public function __construct(
private readonly MailboxProvisioner $mailboxes,
private readonly MailTransport $mail,
) {}
public function handle(Tenant $tenant): void
{
if (! $this->mailboxes->exists($tenant->domain, 'support')) {
$this->mailboxes->create(
domain: $tenant->domain,
login: 'support',
password: Str::password(20),
fullName: "{$tenant->name} Support",
);
}
$this->mail->send(
to: $tenant->owner_email,
subject: 'Your mailbox is ready',
htmlBody: view('mail.mailbox-ready', ['tenant' => $tenant])->render(),
);
}
}
use Siberfx\MailSdkKerioConnect\Facades\KerioConnect;
KerioConnect::mail()->send(
to: '[email protected]',
subject: 'Welcome',
htmlBody: '<p>Welcome aboard.</p>',
);
KerioConnect::mailboxes()->create('tenant.test', 'support', $password, 'Tenant Support');