Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/11/2011, 17:15
voloff
 
Fecha de Ingreso: noviembre-2011
Ubicación: Coruña
Mensajes: 6
Antigüedad: 13 años, 2 meses
Puntos: 0
Pregunta Formulario de contacto con Swift-mailer

Necesito ayuda para crear la página de procesado de Swift-mailer. Se trata de un simple formulario de contacto , pág. en HTML que realiza el proceso en PHP. (procesar.php desde contacto.html). Con su correspondiente redirección a la página de confirmación.
Aun no esta subida al dominio, pero no obstante esta mal igual. Las carpeta lib del swift esta subida en el directorio principal.

Tengo varias opciones.
Código PHP:
<?php
 
require_once "lib/Swift.php";
require_once 
"lib/Swift/Connection/SMTP.php";
 
$swift =& new Swift(new Swift_Connection_SMTP("server.tld"25));
 
$message =& new Swift_Message("Some subject""Your message <u>here</u>""text/html");
 
if (
$swift->send($message"[email protected]""[email protected]"))
{
    echo 
"Message sent";
}
else
{
    echo 
"Message failed to send";
}
 
//It's polite to do this when you're finished
$swift->disconnect();


//MODIFICAR A LA DIRECCIÓN EN SU SERVIDOR
header'Location: http://www.' )
?>
  1. Error en linea 20
Código PHP:
<?php 
$mailer 
=Swift_Mailer::newInstance(Swift_MailTransport::newInstance());

$message Swift_Message::newInstance()
->
setFrom('xxxxx@xxxxxxxxxx')
->
setTo('xxxxxx@xxxxxxxxxx')
->
setBcc($datos[email])
->
setBody(<<<EOF
Nombre: {$datos[nombre]}
Email: 
{$datos[email]}
Telefono: 
{$datos[telefono]}
Tipo: 
{$datos[tipo]}
Mensaje: 
{$datos[mensaje]}
EOF
);

$mailer->send($message);


getMailer()public function execute($arguments = array(), $options = array())
{
  
$mailer $this->getMailer();
  
$mailer->composeAndSend($para$asunto$MESSAGE_BODY$mailheader);
}
//MODIFICAR A LA DIRECCIÓN EN SU SERVIDOR
header'Location: http://www' )
?>
  1. *Error en public function
Código PHP:
<?php

sfCommandApplicationTask
::getMailer()(public function execute($arguments = array(), $options = array())
{
  
$mailer $this->getMailer();
  
$mailer->composeAndSend($para$asunto$MESSAGE_BODY$mailheader);
}
Haber si me pueden echar un cabo