Hello everyone
I have a problem when it comes to attach my attachments to send email
using SwiftMailer, I followed all the steps "believe", to work sends
the message that achievement, but not attached and that can not be
Then I copy them my source hoping I can lend a hand.
$conn = new Swift_Connection_SMTP( 'correo.fcyt.umss.edu.bo');
$mailer = new Swift($conn);
//quien manda el mensaje
$from = new Swift_Address($this-
>getRequestParameter('destinatario'));
//creando lista
$recipients = new Swift_RecipientList();
$recipients->addTo($this->getRequestParameter('recipient'));
$recipients->addBcc('copy');
$subject = $this->getRequestParameter('subjt');
$htmlBody =$this->getRequestParameter('body');
$message = new Swift_Message($subject, $htmlBody);
if (is_writable('C:/tmp'))
{
Swift_CacheFactory::setClassName('Swift_Cache_Disk');
Swift_Cache_Disk::setSavePath('C:/tmp');
}else {
$this->setFlash('error','');
$this->forward('correo','index' ); }
//Somewhere to put information about multiple attachments
$adjuntos = array();
if (!empty($_FILES['adjunto1']['tmp_name']))
{
if ($_FILES['adjto1']['error'])
{
$this->setFlash('error2','');
$this->forward('correo','index' );
}
$adjs[] = array(
'path' => $_FILES['adjunto1']['tmp_name'],
'name' => $_FILES['adjunto1']['name'],
'type' => $_FILES['adjunto1']['type']);
}
foreach ($adjs as $info)
{
$message->attach(new Swift_Message_Attachment(new
Swift_File($info['path']), $info['name'], $info['type']));
}
$message->setContentType("text/html");
if ($mailer->send($message, $recipients, $from)){
}
else{
$this->setFlash('error3','');
$this->forward('correo','index' );
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---