Are you specifically trying to test the sending of mail, or are you testing the rest of the code?
In the case of the former, you need to configure:
SMTP = smtp.example.com
smtp_port = 25
sendmail_from = me@example.com
in your php.ini file (check where it is with phpinfo()), substituting in appropriate values.
To test the code other than the process of sending mail, then I'd recommend creating 2 include files:
<?php
// for live usage/mail send testing
function ori_mail()
{
return call_user_func_array('mail',func_get_args());
}
and for testing other code
function ori_mail()
{
file_put_contents('debug_mail_scripts.txt'
,date('r') . ':' . var_export(func_get_args(), true)
, FILE_APPEND);
}
And include the relevant one to your testing.
Note that testing integration with the SMTP server, and testing deliverbility of your code is rather complex but should be done independently of testing your PHP.
C.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…