Vier Punkte aus kontakterreichbarkeit-mx-bounces-2026-09-15.md, ohne Veroeffentlichungssperre: - PlausibleEmailDomain: Domain ohne Endung oder mit Tippfehler-TLD ist ein 422 an der Legacy-API, deterministisch ohne DNS. - email_domain_checks + MailDomainChecker ueber DnsResolver-Schnittstelle (RFC 5321 impliziter MX, RFC 7505 Null MX, Unresolved ist kein Befund), Observer an Company/Contact, Job nach Commit, taeglicher Refresh, mail:check-domains fuer den Bestand. Nie eine Adresssperre aus DNS. - Admin > Reports > Einlieferer-Bericht: tote Adressen aus Sperrliste und Domainbefund, automatisch abgelehnte Meldungen mit Grund, Text zum Kopieren und CSV. Versendet nichts. - EmailBounceKind::Policy: 5.7.x wird protokolliert, zaehlt aber nicht auf den Schwellwert. Statuscode entscheidet vor Diagnosetext. Messung vorab: 6 von 877 API-Domains ohne Zustellweg, eine davon fuer 66 der 151 Ruecklaeufer verantwortlich. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
68 lines
2.6 KiB
PHP
68 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\Legacy;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Company;
|
|
use App\Rules\PlausibleEmailDomain;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Validation\ValidationException;
|
|
|
|
/**
|
|
* Alt-Vertrag POST /service/users/me/companies/{id}/contacts:
|
|
* Felder unter contact[...], salutation_id 1/2 → mr/mrs (wie ContactImporter),
|
|
* nur eigene Firmen. Paritäts-Doku §1/§4 S1.
|
|
*/
|
|
class LegacyContactController extends Controller
|
|
{
|
|
use RespondsLikeLegacyApi;
|
|
|
|
public function store(Request $request, int $company): JsonResponse
|
|
{
|
|
abort_unless($request->user()->tokenCan('press-releases:write'), 403);
|
|
|
|
$company = Company::withoutGlobalScopes()
|
|
->whereKey($company)
|
|
->accessibleBy($request->user())
|
|
->first();
|
|
|
|
if (! $company) {
|
|
return $this->legacyError(403, ['You may only access companies which are related to your user-account']);
|
|
}
|
|
|
|
try {
|
|
$validated = $request->validate([
|
|
'contact' => ['required', 'array'],
|
|
'contact.salutation_id' => ['nullable', 'integer'],
|
|
'contact.title' => ['nullable', 'string', 'max:100'],
|
|
'contact.first_name' => ['required', 'string', 'max:255'],
|
|
'contact.last_name' => ['required', 'string', 'max:255'],
|
|
'contact.responsibility' => ['nullable', 'string', 'max:255'],
|
|
'contact.phone' => ['nullable', 'string', 'max:100'],
|
|
'contact.fax' => ['nullable', 'string', 'max:100'],
|
|
'contact.email' => ['nullable', 'email', 'max:255', new PlausibleEmailDomain],
|
|
])['contact'];
|
|
} catch (ValidationException $exception) {
|
|
return $this->legacyValidationError($exception);
|
|
}
|
|
|
|
$contact = $company->contacts()->create([
|
|
'portal' => $company->portal?->value,
|
|
'salutation_key' => match ((int) ($validated['salutation_id'] ?? 0)) {
|
|
1 => 'mr',
|
|
2 => 'mrs',
|
|
default => null,
|
|
},
|
|
'title' => $validated['title'] ?? null,
|
|
'first_name' => $validated['first_name'],
|
|
'last_name' => $validated['last_name'],
|
|
'responsibility' => $validated['responsibility'] ?? null,
|
|
'phone' => $validated['phone'] ?? null,
|
|
'fax' => $validated['fax'] ?? null,
|
|
'email' => $validated['email'] ?? null,
|
|
]);
|
|
|
|
return $this->legacyCreated(url("/service/users/me/companies/{$company->id}/contacts/{$contact->id}"));
|
|
}
|
|
}
|