De ingebouwde functie mail() van PHP verstuurt niet rechtstreeks via SMTP —
deze geeft de verzending door aan de lokale mailtransport van uw server, dus de
gateway instellen is hier geen codewijziging; zie
Postfix of Exim, afhankelijk van wat
uw server gebruikt, om op dat niveau te routeren. Verstuurt uw applicatie
rechtstreeks via SMTP — meestal via PHPMailer of Swift Mailer/Symfony Mailer —
configureer dan de instellingen van de gateway rechtstreeks in de
applicatiecode.
PHPMailer
$mail->isSMTP();
$mail->Host = 'smtp.adlerwacht.com'; // zie /introduction/smtp-relay
$mail->Port = 587; // of 465
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // of ENCRYPTION_SMTPS voor 465
$mail->SMTPAuth = true;
$mail->Username = 'you@yourcompany.com';
$mail->Password = 'your-mailbox-password';
Symfony Mailer / Swift Mailer (DSN-stijl)
MAILER_DSN=smtp://you%40yourcompany.com:your-mailbox-password@smtp.adlerwacht.com:587
Gebruik in beide voorbeelden poort 465 met impliciete TLS in plaats van 587/STARTTLS als uw instelling dat verwacht.