36 lines
1.2 KiB
PHP
36 lines
1.2 KiB
PHP
<?php
|
|
// Väliaikainen debug - poista heti testauksen jälkeen!
|
|
header('Content-Type: text/plain; charset=UTF-8');
|
|
|
|
echo "=== MAIL DEBUG ===\n\n";
|
|
|
|
// 1. Sendmail path
|
|
echo "sendmail_path: " . ini_get('sendmail_path') . "\n";
|
|
echo "SMTP: " . ini_get('SMTP') . "\n";
|
|
echo "smtp_port: " . ini_get('smtp_port') . "\n";
|
|
echo "sendmail_from: " . ini_get('sendmail_from') . "\n\n";
|
|
|
|
// 2. Check if sendmail/postfix exists
|
|
echo "mail function exists: " . (function_exists('mail') ? 'YES' : 'NO') . "\n";
|
|
echo "disabled functions: " . ini_get('disable_functions') . "\n\n";
|
|
|
|
// 3. Test send with error logging
|
|
$to = 'asiakaspalvelu@konesaliturku.fi';
|
|
$subject = 'Mailtest ' . date('Y-m-d H:i:s');
|
|
$body = "Tämä on testisähköposti.\n\nAika: " . date('Y-m-d H:i:s');
|
|
$headers = "From: asiakaspalvelu@konesaliturku.fi\r\n";
|
|
$headers .= "Content-Type: text/plain; charset=UTF-8\r\n";
|
|
|
|
// Enable error reporting for mail
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
|
|
echo "Sending to: $to\n";
|
|
echo "Subject: $subject\n";
|
|
echo "From: asiakaspalvelu@konesaliturku.fi\n\n";
|
|
|
|
$result = mail($to, $subject, $body, $headers);
|
|
|
|
echo "mail() returned: " . ($result ? 'TRUE' : 'FALSE') . "\n";
|
|
echo "Last error: " . (error_get_last() ? json_encode(error_get_last()) : 'none') . "\n";
|