30 Dec, 2017

How to send mail using mail function in php

30 Dec, 2017

Dear Reader, let us know that, “How to send mail using mail function in PHP“. So in this Tutorial, We Learn Step By Step Mail Sending Process using mail() function in PHP.

Mail Sending functionality is very important for any Organisation to notify any user to send information Immediately.

In PHP mail() function allows us to send email directly from a script. The mail() function accepts the no. of parameters like

i) Email

ii) Subject

iii) Message

iv) CC Email or BC Email

In the above Parameters Email, Subject and Message Parameters are Mandatory and Rest of Parameters are Optional.

Lets first we see a demo by click on bellow “Demo” Button

Step 1:- Now we need to create index.php file in our project like “C:\xampp\htdocs\php_demo\mail\index.php” and paste below code

Step 2:- Now run your project, so we need to type in browser localhost/your_project_name/mail/


http://localhost/php_demo/mail/ then you can see the result as in below snapshot, you can Send mail By click on Send Mail button


Congratulations you have successfully Completed Mail Sending Process using mail() function in PHP, if you like this post and was helpful for you then share this post on social media and if you have any query then please contact us or comment below and don’t Forget Like and Follow us on Social MediaThanks.


Leave a comment:

Your email address will not be published. Required fields are marked *