- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
mail() function in PHP
The mail() function allows in sending emails directly from a script.
Syntax
mail(to,sub,msg,headers,parameters);
Parameters
to − The receiver / receivers of the email
sub − The subject of the email.
msg − The message to be sent.
headers − The additional headers, such as From, Cc, and Bcc.
parameters − The additional parameter to the sendmail program. This was added in PHP 4.0.5.
Return
The mail() function returns the hash value of the address parameter, or FALSE on failure.
Example
The following is an example to send an email −
<?php $msg = "This is demo text!"; $email_msg = wordwrap($msg,40); mail("demo@example.com","Subject Line",$email_msg); ?>
Advertisements
To Continue Learning Please Login
Login with Google