Read a book today, see mail function, I practiced to write a simple program.
<?php
$tomail = ' webmaster@webjx.com ';
$name = ' WEBJX ';
$text = ' webjx.com is a very good web!! ';
if (Mail ($tomail, $name, $text))//function has 5 parameters The first 3 are required parameters. The first parameter represents the destination address, the second argument is the theme, and the third parameter represents the content.
{
echo ' OK ';
}
Else
{
Echo ' no ';
}
?>
Note that the use of the mail function needs to be configured inside the php.ini.
[Mail Function]
; For Win32.
SMTP = localhost
Smtp_port = 25
; For Win32.
; sendmail_from = me@example.com
After configuration
[Mail Function]
; For Win32.
SMTP = smtp.tom.com//Specify your mailbox SMTP
Smtp_port = 25
; For Win32.
Sendmail_from = webmaster@webjx.com//The mailbox you are using
When configured, remember to restart Apache!
But really strange, in the unit to send a successful, write the same at home did not succeed, everyone to see ~ ~