YouTip LogoYouTip

Func Mail Mail

Rookie Tutorial -- Learning not just technology, but also dreams! Home HTML JAVASCRIPT CSS VUE REACT PYTHON3 JAVA C C++ C# AI GO SQL LINUX VS CODE BOOTSTRAP GIT Local Bookmarks PHP Tutorial PHP Tutorial PHP Introduction PHP Installation PHP Syntax PHP Variables PHP echo/print PHP EOF(heredoc) PHP Data Types PHP Type Comparison PHP Constants PHP Strings PHP Operators PHP If...Else PHP Switch PHP Arrays PHP Array Sorting PHP Superglobals PHP While Loop PHP For Loop PHP Functions PHP Magic Constants PHP Namespaces PHP OOP PHP Quiz PHP Forms PHP Forms PHP Form Validation PHP Form - Required Fields PHP Form - Validate Email and URL PHP Complete Form Example PHP $_GET Variable PHP $_POST Variable PHP Advanced Tutorial PHP Multidimensional Arrays PHP Date PHP Include PHP File PHP File Upload PHP Cookie PHP Session PHP E-mail PHP Secure E-mail PHP Error PHP Exception PHP Filter PHP Advanced Filter PHP JSON PHP 7 New Features PHP 7 New Features PHP Database PHP MySQL Introduction PHP MySQL Connection PHP MySQL Create Database PHP MySQL Create Table PHP MySQL Insert Data PHP MySQL Insert Multiple Data PHP MySQL Prepared Statements PHP MySQL Read Data PHP MySQL Where PHP MySQL Order By PHP MySQL Update PHP MySQL Delete PHP ODBC PHP XML XML Expat Parser XML DOM XML SimpleXML PHP with AJAX AJAX Introduction AJAX PHP AJAX Database AJAX XML AJAX Live Search AJAX RSS Reader AJAX Poll PHP Reference PHP Array PHP Calendar PHP cURL PHP Date PHP Directory PHP Error PHP Filesystem PHP Filter PHP FTP PHP HTTP PHP Libxml PHP Mail PHP Math PHP Misc PHP MySQLi PHP PDO PHP SimpleXML PHP String PHP XML PHP Zip PHP Timezones PHP Image Processing PHP RESTful PHP PCRE PHP Available Functions PHP Composer PHP Libxml Functions PHP 5 Math Functions Deep Dive Math Email & Instant Messaging Mathematics Email Scripting Languages Scripting email Web Service Network Services Programming PHP mail() function Complete PHP Mail Reference Definition and Usage The mail() function allows you to send emails directly from a script. Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise. Syntax mail(to,subject,message,headers,parameters) Parameter Description to Required. Specifies the email recipient(s). subject Required. Specifies the email subject. Note: This parameter cannot contain any newline characters. message Required. Defines the message to be sent. Separate each line with LF (n). Lines should not exceed 70 characters. Windows Note: When PHP connects directly to an SMTP server, if a period is found at the beginning of a line in the message, it will be removed. To fix this, replace single periods with double periods: headers Optional. Specifies additional headers like From, Cc and Bcc. Additional headers should be separated with CRLF (rn). Note: When sending email, it must contain a From header. This can be set via this parameter or in the php.ini file. parameters Optional. Specifies additional parameters for the sendmail program (defined in the sendmail_path configuration setting). Example: When sendmail is used with the -f sendmail option, it can be used to set the sender address. Tips and Notes Note: Keep in mind that just because the email was accepted for delivery, it doesn't mean the email has reached the intended destination. Example 1 Send a simple email: Example 2 Send an email with additional headers: Example 3 Send an HTML email: <?php $to = "somebody@example.com, somebodyelse@example.com"; $subject = "HTML email"; $message = " HTML email

This email contains HTML Tags!

Firstname Lastname
John Doe
"; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "rn"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "rn"; // More headers $headers .= 'From: ' . "rn"; $headers .= 'Cc: myboss@example.com' . "rn"; mail($to,$subject,$message,$headers); ?> Complete PHP Mail Reference PHP Libxml Functions PHP 5 Math Functions ByteArk Coding Plan Supports mainstream models like Doubao, GLM, DeepSeek, Kimi, MiniMax, etc. Official direct supply ensures stability. ¥9.9 / month Subscribe Now iFlytek Star Coding Plan Includes free model call quotas for DeepSeek, GLM, Kimi, MiniMax, a one-stop experience and deployment platform. ¥3.9 / month Subscribe Now Share My Notes Category Navigation Python / Data Science AI / Smart Development Frontend Development Backend Development Database Mobile Development DevOps / Engineering Programming Languages Computer Basics XML / Web Service .NET Website Building Advertisement PHP Tutorial PHP Tutorial PHP Introduction PHP Installation PHP Syntax PHP Variables PHP echo/print PHP EOF(heredoc) PHP Data Types PHP Type Comparison PHP Constants PHP Strings PHP Operators PHP If...Else PHP Switch PHP Arrays PHP Array Sorting PHP Superglobals PHP While Loop PHP For Loop PHP Functions PHP Magic Constants PHP Namespaces PHP OOP PHP Quiz PHP Forms PHP Forms PHP Form Validation PHP Form - Required Fields PHP Form - Validate Email and URL PHP Complete Form Example PHP $_GET Variable PHP $_POST Variable PHP Advanced Tutorial PHP Multidimensional Arrays PHP Date PHP Include PHP File PHP File Upload PHP Cookie PHP Session PHP E-mail PHP Secure E-mail PHP Error PHP Exception PHP Filter PHP Advanced Filter PHP JSON PHP 7 New Features PHP 7 New Features PHP Database PHP MySQL Introduction PHP MySQL Connection PHP MySQL Create Database PHP MySQL Create Table PHP MySQL Insert Data PHP MySQL Insert Multiple Data PHP MySQL Prepared Statements PHP MySQL Read Data PHP MySQL Where PHP MySQL Order By PHP MySQL Update PHP MySQL Delete PHP ODBC PHP XML XML Expat Parser XML DOM XML SimpleXML PHP with AJAX AJAX Introduction AJAX PHP AJAX Database AJAX XML AJAX Live Search AJAX RSS Reader AJAX Poll PHP Reference PHP Array PHP Calendar PHP cURL PHP Date PHP Directory PHP Error PHP Filesystem PHP Filter PHP FTP PHP HTTP PHP Libxml PHP Mail PHP Math PHP Misc PHP MySQLi PHP PDO PHP SimpleXML PHP String PHP XML PHP Zip PHP Timezones PHP Image Processing PHP RESTful PHP PCRE PHP Available Functions PHP Composer Online Examples ·HTML Examples ·CSS Examples ·JavaScript Examples ·Ajax Examples ·jQuery Examples ·XML Examples ·Java Examples Charsets & Tools · HTML Charset Settings · HTML ASCII Charset · JS Obfuscation/Encryption · PNG/JPEG Image Compression · HTML Color Picker · JSON Formatter · Random Number Generator Recent Updates · Dart Enums & Symbols · Dart Unit Testing · Dart Concurrency & Iso... · Dart Streams · Dart Async Programming · Dart typedef &... · Dart Package Management Site Info · Feedback · Disclaimer · About Us · Article Archive Follow WeChat My Bookmarks Mark Article Browse History Clear All No records yet ```
← Func Math AbsFunc Libxml Use Internal Error →