Been there for days wraps over the fact that I can create a script that sends HTML mail template, and in case the user has a client who can not read HTML and plain text listing
Why don't you use MailChimp for that? It seems to have all the features you want.
You should add html and plain text version of email called multipart/alternative
in same email body:
<?php
$from = "a asd";
$email = "sd@dfsds.com";
$email = "sdsad@sdfsdf.com";
$semi_rand = md5(time());
$mime_boundary = "==MULTIPART_BOUNDARY_$semi_rand";
$mime_boundary_header = chr(34) . $mime_boundary . chr(34);
$boundary = "nextPart";
$headers = "From: \"".$from."\" <".$email.">\n";
$headers .= "To: ". $new_to ."\n";
$headers .= "Reply-To: \"". $from. "\" <" . $email . ">\r\n";
$headers .= "Return-Path: <". $email .">\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/alternative;\n boundary=" . $mime_boundary_header ;
$headers .= "\n--$boundary\n"; // beginning \n added to separate previous content
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "\n--$boundary\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding:base64\r\n";
$body = "
--$mime_boundary
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
". strip_tags($messageBody) ."
--$mime_boundary
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding:base64
". chunk_split(base64_encode($messageBody)) ."
--$mime_boundary--";
mail(null,$sub,$body,$headers,"-f".$email);