Question:Explain the parameters of PHP’s mail function. 

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

Prototype:

boolean mail(string to, string subject, string message [, string addl_headers [, string addl_params]])

ParameterDescription
toRequired. Specifies the receiver / receivers of the email
subjectRequired. Specifies the subject of the email. Note: This parameter cannot contain any newline characters
messageRequired. Defines the message to be sent. Each line should be separated with a LF (\n). Lines should not exceed 70 characters
headersOptional. Specifies additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF (\r\n)
parametersOptional. Specifies an additional parameter to the sendmail program


Example:

<?php
  
    mail("client@example.com","This is a subject","This is the mail body","from:admin@example.com\r\n");

?> 


Deprecated: html_entity_decode(): Passing null to parameter #1 ($string) of type string is deprecated in D:\webserver\www\vcampusbd.com\answers\column_answer_two.php on line 128
+ Report
Total Preview: 794
Explain the parameters of PHP’s mail function.
Copyright © 2024. Powered by Intellect Software Ltd