PHP

How to send Mail Using PHP

Written by Anuj kumar

In this tutorial i will explain how to send mail using PHP mail function.The mail() function allows you to send emails directly from a script.

PHP Mail Function 
mail(to,subject,message,headers,parameters);

Parameters Description
to Required. Specifies the receiver / receivers of the email
subject Required. Specifies the subject of the email. Note: This parameter cannot contain any newline characters
message Required. Defines the message to be sent. Each line should be separated with a LF (n)not more than 70 characters.
headers Optional. Specifies additional headers like From Ccand Bcc.
parameters Optional. Specifies an additional parameter to the sendmail program (the one defined in the sendmail_path configuration setting).

First create a html form with three fileds

  • Email
  • Subject
  • Message

Index.php

PHP CODE put this code top on the index.php page
       
Download Source Code(Send mail using PHP Function)
Size: 26.6 KB
Version: V 1.0

About the author

Anuj kumar

I'm Anuj kumar a web developer with 4+ year experience .I write blogs in my free time. I love to learn new technologies and share with others. I founded PHPGurukul in September 2015. The main aim of this website to is provide php , jquery , mysql , phpoops and other web development tutorials. I am trying best effort to make PHPGurukul useful for every single moment spend on this website. If you think this website is useful to visit please share with your friend and buddies.