I am sending a mail using PEAR\'s mail and mail_mime packages and sample code as below:
$sendStart=array();
require_once(\'Mail.php\');
require_once(\'Mail/m
Here is the example of it -
// Set up the headers that will be included in the email.
$recipient = 'someemail@gmail.com';
$from = 'someemail1@gmail.com';
$headers = array(
'To' => $recipient,
'From' => $from,
'Return-Path' => $from,
'Reply-To' => $replyto, //based on your need
'Subject' => $subject,
'Errors-To' => '<errors@example.com>',
'MIME-Version' => '1.0',
);
// Set up parameters for both the HTML and plain text mime parts.
$textparams = array(
'charset' => 'utf-8',
'content_type' => 'text/plain',
'encoding' => 'quoted/printable',
);
$htmlparams = array(
'charset' => 'utf-8',
'content_type' => 'text/html',
'encoding' => 'quoted/printable',
);
// Create the email itself. The content is blank for now.
$email = new Mail_mimePart('', array('content_type' => 'multipart/alternative'));
// Add the text and HTML versions as parts within the main email.
$textmime = $email->addSubPart($textbody, $textparams);
$htmlmime = $email->addSubPart($htmlbody, $htmlparams);
// Get back the body and headers from the MIME object. Merge the headers with
// the ones we defined earlier.
$final = $email->encode();
$final['headers'] = array_merge($final['headers'], $headers);
// Perform the actual send.
$smtp_params = array();
$smtp_params['host'] = '127.0.0.1';
$smtp_params['port'] = '25';
$smtp_params['persist'] = TRUE;
$mail =& Mail::factory('smtp', $smtp_params);
$status = $mail->send($recipient, $final['headers'], $final['body']);