Ver Mensaje Individual
  #4 (permalink)  
Antiguo 28/07/2009, 08:12
Avatar de aliza
aliza
 
Fecha de Ingreso: diciembre-2008
Mensajes: 156
Antigüedad: 15 años, 4 meses
Puntos: 6
Respuesta: Enviar texto por email

Hola dickies. Si entiendo bien, deberías hacer esto más o menos:
- En tu html tendrás un formulario que tienes que enviar por método POST por ejemplo. Pasas por POST al php la variable con el producto a reservar.
- Desde el script de envío de correo rescatas esa variable POST y envías el mail.

Código para enviar mail:

Código php:
Ver original
  1. <?php
  2. require_once dirname(__FILE__) . '/config.php';  
  3. require_once 'lib/swift_required.php';
  4. require_once "lib/classes/Swift.php";
  5. //Create the Transport the call setUsername() and setPassword()
  6. $transport = Swift_SmtpTransport::newInstance('TUSERVIDORSMTP', 25)
  7.   ->setUsername('TUUSUARIO')
  8.   ->setPassword('TUCONTRASEÑA')
  9.   ;
  10. //Create the Mailer using your created Transport
  11. $mailer = Swift_Mailer::newInstance($transport);
  12. //Create the message
  13. $message = Swift_Message::newInstance()
  14.   //Give the message a subject
  15.   ->setSubject('ELASUNTO')
  16.   //Set the From address with an associative array
  17.   ->setFrom(array('DIRECCIONDESDELAQUESEENVIA' => 'NOMBREREMITENTE'))
  18.   //Set the To addresses with an associative array
  19.   ->setTo(array('DIRECCIONDESTINATARIO1','DIRECCIONDESTINATARIO2'))
  20.   //Give it a body
  21.   ->setBody('TEXTODELMENSAJE')
  22.   //And optionally an alternative body
  23.   //->addPart('<q>Here is the message itself</q>', 'text/html')
  24.   //Optionally add any attachments
  25.   ->attach(Swift_Attachment::fromPath('gpclub_a.xls'))
  26.   ;
  27.   //Send the message
  28.   $numSent = $mailer->send($message);
  29. printf("Enviados %d Mensajes\n", $numSent);
  30. ?>
__________________
Dando cabezados se aprende...

Última edición por jam1138; 28/07/2009 a las 11:23