#native_company# #native_desc#
#native_cta#

Sending Multipart Mime Encoded Email

By David McInnis
on March 10, 2002

Version: 0.5

Type: Function

Category: HTTP

License: GNU General Public License

Description: This function allows you to send a multi part mime encoded email (HTML and Plain Text). You pass the HTML and TEXT messages in as strings.

// *** Sends and email message based on parameters passed ***//

function send_multiemail ($lc_recipient_email, $lc_recipient_name, $lc_subject, $lc_from_email, $lc_from_name, $lc_sender, $lc_priority, $lc_return, $lc_html, $lc_text)
{
	// send email
	
	$boundary = "----=_NextPart_000_" . uniqid("DO_PHP");

	// text
	$lc_message .= "--$boundaryn";
	$lc_message .= "Content-Type: text/plain; ntcharset="iso-8859-1"n";
	$lc_message .= "Content-Transfer-Encoding: 7bitn";
	$lc_message .= $lc_text . "n";

	// html
	$lc_message .= "--$boundaryn";
	$lc_message .= "Content-Type: text/html; ntcharset="iso-8859-1"n";
	$lc_message .= "Content-Transfer-Encoding: 7bitn";
	$lc_message .= $lc_html;


	// final boundary
	$lc_message .= "n--$boundary--";

	/* recipients */
	$lc_recipient = "$lc_recipient_name <$lc_recipient_email>";

	/* subject */
	$lc_subject = "$lc_subject";

	$lc_headers  = "From: $lc_from_name <$lc_from_email>n";
	$lc_headers .= "X-Sender: <$lc_sender>n"; 
	$lc_headers .= "X-Mailer: DataOvationn"; // mailer
	$lc_headers .= "Return-Path: <$lc_return>n";  // Return path for errors
	$lc_headers .= "Mime-Version: 1.0n";
	$lc_headers .= "Content-Type: multipart/alternative; boundary="$boundary"n";
	$lc_headers .= "X-Priority: $lc_priority"; // Urgent message!
	
	
	mail($lc_recipient, $lc_subject, $lc_message, $lc_headers);
		
	//end email stuff
	
	return "";
}