please explain me mail function in php

Answers were Sorted based on User's Feedback



please explain me mail function in php..

Answer / nirjesh pandey

The PHP mail() Function:

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

Syntax
mail(to,subject,message,headers,parameters)

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 characters
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

Note: For the mail functions to be available, PHP requires
an installed and working email system. The program to be
used is defined by the configuration settings in the php.ini
file. Read more in our PHP Mail reference.
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:
<?php
$to = "someone@example.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>

Is This Answer Correct ?    8 Yes 2 No

please explain me mail function in php..

Answer / amit kumar

it is done through a methode called mail() and it is declaired directly

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

Tell me how can we automatically escape incoming data?

0 Answers  


how to track user logged out or not? when a user is idle?

0 Answers  


Who is the father of PHP and explain the changes in PHP versions?

2 Answers   Rushmore Consultancy,


How To Get the Uploaded File Information in the Receiving Script?

0 Answers  


In mail($param1, $param2, $param3, $param4), the $param2 contains__

1 Answers  






What are the different methods of passing data or information between two calls of a web page? What are the advantages/disadvantages of these methods?

4 Answers   Ardo, Patni,


Explain about error handling in php?

1 Answers   INDUS, Life Infotech, Yahoo,


Suppose your Zend engine supports the mode <? ?> Then how can u configure your PHP Zend engine to support <?PHP ?> mode ?

4 Answers  


Where is my php ini file?

0 Answers  


How can we convert the time zones using PHP?

1 Answers  


What is session in php why it is use?

0 Answers  


Is laravel easy to learn?

0 Answers  


Categories