fix
This commit is contained in:
@@ -442,11 +442,28 @@ function send_email($to, $subject, $message) {
|
||||
*/
|
||||
function send_smtp_email($to, $subject, $message) {
|
||||
try {
|
||||
// Connessione al server SMTP
|
||||
$smtp = fsockopen(SMTP_HOST, SMTP_PORT, $errno, $errstr, 30);
|
||||
// Connessione al server SMTP con supporto SSL/TLS
|
||||
$context = stream_context_create([
|
||||
'ssl' => [
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false,
|
||||
'allow_self_signed' => true
|
||||
]
|
||||
]);
|
||||
|
||||
// Per SSL (porta 465) usa protocollo ssl://, per TLS (porta 587) connessione normale
|
||||
$protocol = (SMTP_ENCRYPTION === 'ssl') ? 'ssl://' : '';
|
||||
$smtp = stream_socket_client(
|
||||
$protocol . SMTP_HOST . ':' . SMTP_PORT,
|
||||
$errno,
|
||||
$errstr,
|
||||
30,
|
||||
STREAM_CLIENT_CONNECT,
|
||||
$context
|
||||
);
|
||||
|
||||
if (!$smtp) {
|
||||
error_log("SMTP Error: Impossibile connettersi a " . SMTP_HOST . ":" . SMTP_PORT);
|
||||
error_log("SMTP Error: Impossibile connettersi a " . SMTP_HOST . ":" . SMTP_PORT . " - $errstr ($errno)");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user