
25/08/2009, 08:17
|
 | | | Fecha de Ingreso: diciembre-2008
Mensajes: 156
Antigüedad: 16 años, 3 meses Puntos: 6 | |
No es por eso, es porque no pones desde que dirección enviarlo.
<?php
require_once dirname(__FILE__) . '/config.php';
require_once 'lib/swift_required.php';
require_once "lib/classes/Swift.php";
// require_once "lib/classes/Swift/Connection/SMTP.php";
//Create the Transport the call setUsername() and setPassword()
$transport = Swift_SmtpTransport::newInstance('servidorsmtp', 25)
->setUsername('nombreusuariosmtp')
->setPassword('contraseña')
;
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
//Create the message
$message = Swift_Message::newInstance()
//Give the message a subject
->setSubject('ASUNTO')
//Set the From address with an associative array
->setFrom(array('direccionremitente' => 'Nombre remitente para mostrar'))
//Set the To addresses with an associative array
->setTo(array('direcciondestino'))
//Give it a body
->setBody('Cuerpo del mensaje.')
//And optionally an alternative body
//->addPart('<q>Here is the message itself</q>', 'text/html')
//Optionally add any attachments
//->attach(Swift_Attachment::fromPath('adjunto'))
;
//Send the message
$numSent = $mailer->send($message);
printf("Enviados %d Mensajes\n", $numSent);
?>
Con este código podrás enviar correos, adaptándolo a tus condiciones.
__________________ Dando cabezados se aprende...
Última edición por GatorV; 25/08/2009 a las 08:34 |