#!/usr/bin/env python3
"""Проверка доступности портов SMTP (465 и 2525) для smtp.mail.ru."""
import socket

host = "smtp.mail.ru"
ports = [465, 2525]
timeout = 10

for port in ports:
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.settimeout(timeout)
        err = s.connect_ex((host, port))
        s.close()
        status = "доступен" if err == 0 else "недоступен"
        print(f"  {host}:{port} — {status}")
    except Exception as e:
        print(f"  {host}:{port} — ошибка: {e}")
