Código PHP:
<?php
// Example by deerme.org
require_once("Mail.php");
require_once("Mail/mime.php");
$sender = "[email protected]";
$recipients = array("[email protected]","[email protected]");
$subject = "Asunto";
$text = 'Texto';
$config = array(
"host" => "***",
"username" => "***" ,
"password" => "***" ,
"auth" => true
);
$headers = array('From'=> $sender,'Return-Path'=>$sender,'Subject'=> $subject);
$xmail = new Mail_mime("/n");
$xmail->setTXTBody($text);
$xmail->addAttachment("/var/www/html/wp-content/uploads/documentos/documento1.pdf", "application/pdf", "documento1.pdf");
$body = $xmail->get();
$headers = $xmail->headers($headers);
$smail =& Mail::factory('smtp', $config );
foreach( $recipients as $k => $recipient )
{
$smail->send($recipient, $headers, $body);
}
?>
Versiones:
- Centos 6.3
- mail de pear: 1.2.0
- mail_mime de pear: 1.8.5
- PHP 5.3
Un cordial saludo.