Bang hộiTiền mặt: 0 Xu Trò chơiHộp quà giáng sinhThứ Bảy, 23:29:29 - 27/04/2024
Chia sẻ kiến thức ngôn ngữ lập trình C, C++, C#, Java, Python, PHP, JS, SQL ...

Các điều hành viên: Mod, SMod, Admin

[PHP] How to check PHP send mail() function - Kiểm tra hàm send mail() php có hoạt động không?

[PHP] How to check PHP send mail() function - Kiểm tra hàm send mail() php có hoạt động không?

#1 » Gửi bài gửi bởi nghiatichxanh1992 » 23/07/2015 00:39 » @406925

To test PHP mail functionality, you can use the following code saved into a file with a .php extension:

Important: We recommend using an SMTP relay that requires authentication. Sending mail through unauthenticated SMTP servers (including the localhost relay on Cloud Sites) can result in delays or undelivered email because of stringent anti-spam filters.
Mã: Chọn tất cả
<?php
$headers 
= 'From: webmaster@example.com'; mail('nobody@example.com', 'Test email using PHP', 'This is a test email message', $headers, '-fwebmaster@example.com'); 
?>


Alternatively, you can use the following test code:
Mã: Chọn tất cả
<?php
$to 
= 'nobody@example.com'; $subject = 'Test email using PHP'; $message = 'This is a test email message'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers, '-fwebmaster@example.com'); 
?>


View more: http://www.rackspace.com/knowledge_center/article/test-php-mail-functionality
Sửa lần cuối: nghiatichxanh1992 23/07/2015 00:48

Những người đã like nghiatichxanh1992 bởi bài viết có ích này (Tổng: 2):
Pokemon12NgoHaiThien
Rating: 0.27%
 
nghiatichxanh1992 ✅
Hình đại diện của thành viên
Rank: ☀️2/30☀️
Cấp độ:
Tu luyện:
Like:
Online:
Bang hội: Tiếu Ngạo
Xếp hạng Bang hội: ⚡5/60⚡
Level:
Chủ đề đã tạo: 🩸4140/4140🩸
Tiền mặt:
Ngân hàng:
Nhóm:
Danh hiệu: ⚝Truyền Thuyết⚝
Giới tính:
Ngày tham gia:
Đến từ:
Thiết bị:
Số điện thoại:
(Cốc Cốc 49.0)


Quay về C, C++, C#, Java, Python, PHP, JS, SQL ...

 


  • Chủ đề tương tự
    Trả lời
    Xem
    Bài viết mới nhất