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ã nguồn PHP:
<?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ã nguồn PHP:
<?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_c...-functionality