Category: ASP General

Sending E-Mail(s) in PHP

This tutorial is an introduction to sending E-mails using PHP. You will learn about the PHP Mail function to send email and how to Create a PHP Form that sends email(s) using this function.

PHP mail() function

E-mails in PHP can be easily sent using the library function ‘mail’. This function takes four arguments to send E-mails from a PHP web page and returns ‘true’ upon successful delivery of Email. The parameters of this function are as follows:

* Recipient E-mail address
* E-mail Subject
* E-mail message (body)
* Headers and additional parameters like the Sender E-mail address

Syntax:

mail ( string to, string subject, string message [[, string additional_headers [[, string additional_parameters )

This function returns the boolean value ‘True’ if the mail is sent successfully, otherwise it returns ‘False’.

Example:

To :

From :

Subject :

Message(body) : Welcome to Hyve’s PHP Tutorial section

Above forms shows how to send email through PHP. And code for the above examples given below, use this code and try it.

Sample PHP Code


Cut ‘n’ Paste Code

 

To :
From :
Subject :
Mesage(body) :

 

 

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.