HOW TO SEND EMAIL USING PHP

Sending email in php is very easy. What we need to do is, we have to give proper email ID,subject  and message in the predefined php email function. Lets see the php email syntax to get clear idea about php mail functions.

PHP Mail Syntax
mail(to,subject,message,headers,parameters);
here,
ToRequired. Destination Email ID.
Subject Required. Email Subject or heading.
MessageRequired. Message to be sent. It can be in the form or normal text or HTML.
HeadersOptional. To add cc, bcc etc. The additional headers must be separated with (\r\n).
ParametersOptional.

Sample Program:

Output:
If the mail was sent successfully, then you will get output as "Success.. Email was sent to : admin@studentsblog100.in" or else you will get Error in sending php mail.

Unable to receive php emails ?
× Note! You can't receive mails in GMAIL accounts if php is hosted in localhost. Because, Gmail auto spam messages detecting system will neglect it.

Click Here to get -- > PHP Tutorials by Studentsblog100
Previous
Next Post »