I am currently learning the basic grammar in W3school and see the case of sending email
$to = "someone@example.com";
$subject = "Test mail";
$message = "hello! A simple email message. ";
$from = "someonelse@example.com";
$headers = "From: $from";
Mail ($to, $subject, $message, $headers);
echo "Mail Sent.";
?>
Test cannot send mail
Would like to consult the PHP e-mail Just a few words of simple code can be achieved? Do not need the sender's account password, and other settings?
Reply to discussion (solution)
Please refer to the video tutorial Http://pan.baidu.com/s/1rIJeU or http://www.zixue.it/portal.php?mod=list&catid=11 using PHP Mailer to send an email.
The Mail function can only send mail using a sender server that does not require user authentication
If you use a sender server that does not have user authentication, you also need to configure it in php.ini to use the Mail function
Require_once (' email.class.php ');
//##########################################
$smtpserver = "smtp.163.com";//SMTP server
$smtpserverport =25;//SMTP Server Port
$smtpusermail = "Your @163.com";//smtp the user mailbox of the server
$smtpemailto = $email;//Send To whom
$smtpuser = "name"; user account for//SMTP server
$smtppass = "ADDFGFDG"; user password for//SMTP server
$mailsubject = "Mail subject";//Message subject
$mailbody = "Message content Mail content mail Content"//message content
$mailtype = "HTML";//Message Format (html/txt), TXT as text mail
$SMTP = new SMTP ($smtpserver, $smtpserverport, True, $smtpuser, $smtppass);//A true in this indicates that authentication is used, otherwise no authentication is used.
$SMTP->debug = false;//whether to display debug information sent
$smtp->sendmail ($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
?>
Need certification, or use Phpmailer bar, simple configuration a few can be.