Ga ook even na op welke manier de mailserver van Versio/AXC je authenticatie regelt, en of de poort klopt etc.
Soms wil het wel eens anders zijn dan standaard.
Volgens mij hebben ze het bij Versio toch weer over de standaard mail-functie...
De mailcommunicatie met Versio:
Guido:
Ik probeer een PHP-scriptje te schrijven voor het versturen van een mail via PHPMailer.
Het struikelblok voor nu is de mailauthenticatie. Zijn daaraan voor Versio nog instellingen anders.
Mijn huidige script ziet er nu (gedeeltelijk) zo uit:
<?php
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'mail.axc.nl';
$mail->SMTPAuth = true;
$mail->Username = 'guido@domein.nl';
$mail->Password = 'geheim';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
?>
Versio:
Hartelijk bedankt voor uw bericht.
U dient dan aan het script toe te voegen:
'auth' => true,
'username' => $username,
'password' => $password));
Voorbeeldscript:
require_once "Mail.php";
$username = 'guido@domein.nl';
$password = 'password';
$smtpHost = 'mail.axc.nl';
$smtpPort = '587';
$to = 'mail@to.com';
$from = 'user@mail.com';
$subject = 'Contact Form';
$successMessage = 'Message successfully sent!';
$replyTo = '';
$name = '';
$body = '';
$headers = array(
'From' => $name . " <" . $from . ">",
'To' => $to,
'Subject' => $subject
);
$smtp = Mail::factory('smtp', array(
'host' => $smtpHost,
'port' => $smtpPort,
'auth' => true,
'username' => $username,
'password' => $password
));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo($mail->getMessage());
} else {
echo($successMessage);
}
Guido:
Ik betwijfel of hier misschien sprake is van communicatiemisverstand.
Is deze oplossing van toepassing voor PHPMailer (
https://github.com/PHPMailer/PHPMailer)?
Versio:
Ja, deze oplossing is daar van toepassing:
https://www.versio.nl/artikelen/372-hoe-verstuur-ik-mail-via-de-php-functie-mail