Skip to content

Nuface Blog

隨意隨手記 Casual Notes

Menu
  • Home
  • About
  • Services
  • Blog
  • Contact
  • Privacy Policy
  • Login
Menu

Category: PHP

About PHP

Testing SMTP with PHP (PHP 7.4 Example)

Posted on 2025-11-062025-11-06 by Rico

When setting up a mail server (like Postfix + Dovecot) or debugging email delivery, it’s often necessary to verify whether your SMTP host works correctly and if your credentials are valid.Here are two practical methods you can use with PHP 7.4. ✅ Method 1: Using PHPMailer (Recommended) PHPMailer is a full-featured mailer library supporting STARTTLS…

Read more

使用 PHP 測試 SMTP 功能(PHP 7.4 範例)

Posted on 2025-11-062025-11-06 by Rico

在開發郵件系統或部署郵件伺服器(如 Postfix、Dovecot)時,常常需要快速驗證 SMTP 主機是否可用、帳號密碼是否正確。本文提供兩種實用方式,使用 PHP 7.4 即可輕鬆測試郵件寄送與認證。 ✅ 方法一:使用 PHPMailer(推薦) 這是最直覺、最穩定的做法。PHPMailer 支援 STARTTLS / SMTPS / AUTH LOGIN,並能顯示詳細的 SMTP 除錯訊息。 安裝 若可使用 Composer: 範例程式:smtp_test.php 若無法使用 Composer,可直接下載 PHPMailer 的三個核心檔案:PHPMailer.php, SMTP.php, Exception.php,並在程式中手動引用。 ✅ 方法二:純 PHP Socket 測試(不發信,只測握手) 這個版本不寄信,只測試 連線 → STARTTLS → AUTH LOGIN 是否正常。非常適合快速檢查主機、TLS 或帳密問題。 🔍 常見錯誤與排查 問題 原因與建議 Connection timed out 主機或連接埠錯誤、防火牆阻擋 Peer certificate CN…

Read more

Recent Posts

  • Postfix + Let’s Encrypt + BIND9 + DANE Fully Automated TLSA Update Guide
  • Postfix + Let’s Encrypt + BIND9 + DANE TLSA 指紋自動更新完整教學
  • Deploying DANE in Postfix
  • 如何在 Postfix 中部署 DANE
  • DANE: DNSSEC-Based TLS Protection

Recent Comments

  1. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on High Availability Architecture, Failover, GeoDNS, Monitoring, and Email Abuse Automation (SOAR)
  2. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on MariaDB + PostfixAdmin: The Core of Virtual Domain & Mailbox Management
  3. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Daily Operations, Monitoring, and Performance Tuning for an Enterprise Mail System
  4. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Final Chapter: Complete Troubleshooting Guide & Frequently Asked Questions (FAQ)
  5. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Network Architecture, DNS Configuration, TLS Design, and Postfix/Dovecot SNI Explained

Archives

  • December 2025
  • November 2025
  • October 2025

Categories

  • AI
  • Apache
  • Cybersecurity
  • Database
  • DNS
  • Docker
  • Fail2Ban
  • FileSystem
  • Firewall
  • Linux
  • LLM
  • Mail
  • N8N
  • OpenLdap
  • OPNsense
  • PHP
  • QoS
  • Samba
  • Switch
  • Virtualization
  • VPN
  • WordPress
© 2025 Nuface Blog | Powered by Superbs Personal Blog theme