How to send mail using PHP?

-The PHP mail() function is used to send emails from inside a script.


Parameter 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 character.

message       Required. Defines the message to be sent. Each line should be separated with a LF (\n).
                      Lines should not exceed 70 characters

headers      Optional. Specifies additional headers, like From, Cc, and Bcc. The additional headers
                     should be separated with a CRLF (\r\n)

parameters Optional. Specifies an additional parameter to the sendmail program

PHP Simple E-Mail
The simplest way to send an email with PHP is to send a text email.

In the example below we first declare the variables ($to, $subject, $message, $from, $headers), then we use the variables in the mail() function to send an e-mail:

$to = "";
$subject = "THIS IS SUBJECT";
$message = "Hello! This is a simple message.";
$from = "";
$headers = "From: $from";
echo "Mail Sent.";

No comments:

Post a Comment

We are here to listen you, Comment your valueable opinion...!!!