User Tools

Site Tools


Send test email via php

Create the test-email.php script with the following:

            ini_set( 'display_errors', 1 );
            error_reporting( E_ALL );
            $from = "emailtest@YOURDOMAIN";
            $to = "YOUREMAILADDRESS";
            $subject = "PHP Mail Test script";
            $message = "This is a test to check the PHP Mail functionality";
            $headers = "From:" . $from;
            mail($to,$subject,$message, $headers);
            echo "Test email sent";

Change from and to fields to match your mail.

From server cmd line execute

php test-email.php

Tested on

See also


wiki/send_test_email_via_php.txt · Last modified: 2021/04/14 13:15 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki