Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/10/2008, 06:17
riscking
 
Fecha de Ingreso: marzo-2008
Mensajes: 82
Antigüedad: 16 años, 1 mes
Puntos: 0
error mandando mail con xajax

He encontrado un script de como mandar un mail con xajax q es algo muy poco comentao y me sale una alerta de error :

Error: the xajax javascript component could not be included. Pherhaps the URL is incorrect?
URL: ../xajax_js/xajax_core.js

El escript es este:

Código:
<?php
//Use Xajax 0.5 beta 1
require ('xajax/xajax_core/xajax.inc.php');

function sendmail($formData)
{
    $response = new xajaxResponse();
   $response->setCharacterEncoding('ISO-8859-1');

    //verify input
    if($formData['name'] != "" && $formData['email1'] != "" && $formData['email2'] != ""){
        $to      = $formData['email2'];
        $subject = 'the subject';
        $message = 'hello, mail from '.$formData['name'].'\nTest XAJAX';
        $headers = 'From: '.$formData['email1']. "\r\n".'Reply-To: '.$formData['email1']."\r\n".'X-Mailer: PHP/'.phpversion();
        if (mail($to, $subject, $message, $headers)) $reponse->alert('Send: OK');
        else $reponse->alert('Send: No OK');
    } else $reponse->alert('You must enter , name and mails !');   

    return $reponse;
}

$xajax = new xajax();
$xajax->registerFunction("sendmail");
$xajax->processRequest();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>xajax example</title>
    <?php $xajax->printJavascript('xajax/'); ?>
</head>
<body style="text-align:center;">
<div id="namediv"></div>
<form action="javascript:void(null);" method="post" name="form1" id="form1" onsubmit="xajax_sendmail(xajax.getFormValues('form1'));return false">
    Your name : <input name="name" type="text"  id="nom" size="25">
    Your email : <input name="email1" type="text" id="email1" size="25">
    email of your friend : <input name="email2" type="text" class="zonedetexteadmin" id="email2" size="25">
    <input name="Submit" type="submit" value="Send">
</form>
</body>
</html>
Creo q a mas de uno si funciona le seria util porque todo lo comentao en referente a xajax con mail es el phpmail q a mi gusto no va fino.

A ver si me podeis hechar una mano.

Última edición por riscking; 15/10/2008 a las 06:52