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

Hình đại diện của thành viên
#1 23/07/2015 00:39
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ã:
<?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ã:
<?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
(Cốc Cốc 49.0)
PM|Trích|Like|Sửa|Xóa|Báo cáo|Cảnh cáo
Sửa lần cuối: nghiammo1992 23/07/2015 00:48
------------
Những người đã like nghiammo1992 bởi bài viết có ích này (Tổng: 2):
Pokemon12NgoHaiThien
_______________
Diễn đàn chia sẻ kiến thức máy tính:
KETNOI123.COM

Ấn hiện ra để xem chữ ký của mình:

Trả lời nhanh

Chủ đề tương tự
Ai đang trực tuyến?