PHP syntax (5)

Source: Internet
Author: User

You can use the mail () function to send emails online. The format is as follows:
Mail (recipient, subject, content, mail file header );
On the Internet, send an Email to the webmaster, typically like this: <a href = "mailto:"> </a> so that when you click the webmaste sites link, the default mail editor will be started to write emails. This is really troublesome. You can easily compile an online mail page by using the mail () function. The recipient of this sort page is fixed (, there is a need to fill in the recipient address, and the subject we can also set it down. For example:
File: email.html
<Title> send a mail to the network administrator </title>
<H2 align = "center"> network administrator reception <Hr> <br>
<Form action = "mail. php">
Sender: <input type = "text" name = "from" size = 25> <br>
Topic: <input type = "text" name = "subject" size = 20> <br>
<Textarea name = "content" cols = 80 rows = 15> hello, Webmaster: </textarea> <br>
<Input type = "submit" value = "send"> <input type = "reset" value = "Rewrite"> <br>
File: mail. php
<? Php
If (empty ($ from) or empty ($ subject) or empty ($ content) {echo "is not completed, <a href = "email.html"> return </a> ";}
$ Body = "[subject] $ subjectn ";
$ Body. = "[Sender] $ fromn ";
$ Body. = $ content;
$ Deal = mail ("", $ subject, $ body, "From: $ from ");
If ($ deal) {echo "mail successful! ";} Else {echo" failed to send !!! ";}
It's almost the same as PHP. Do you feel the power of PHP and want to join the ranks of PHP. To make yourself fly in PHP, this knowledge is still insufficient. It can only help you get started. After getting started, you will practice yourself. Goodbye, my friend -- (^_^)
-- (Full text )--

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.