Hola, llevo semanas peleándome con el formulario y no hay manera de que se envíe. Ya he comprobado que el servidor funciona en php y admite smtp. En principio no me da ningún error, pero el formulario nunca llega a enviarse. ¿Qué puede ser?? ayudaaa!!!
Código PHP:
Ver original<?php
//-----------------Getting data sent by flash---------------------
foreach ($_POST as $key => $value){
if ($key != 'mail_to' && $key != 'smtp_server' && $key != 'smtp_port' && $key != 'mail_from' && $key != 'mail_subject' && $key != 'plain_text'){
$mail_body .= '<b>'.str_replace('_',' ',$key).'</b>:<br/>';
}
}
//-----------------------------------------------------------------
$message = '<html><body>'.$mail_body.'</body></html>'; // mail body
//------------if plain text is set to true removing html tags------
if ($_POST['plain_text']=='true') {
//------------------------------------------------------------------
} else {
//----otherwise composing message headers---------------------------
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=windows-1251' . "\r\n";
//------------------------------------------------------------------
}
//------------setting conf data-------------------------------------
$to = $_POST['mail_to'];
$from = $_POST['mail_from'];
$subject = $_POST['mail_subject'];
$smtp_server = $_POST['smtp_server'];
$smtp_port = $_POST['smtp_port'];
//------------------------------------------------------------------
//---------setting header info--------------------------------------
$headers .= 'From:' .$from;
//------------------------------------------------------------------
if (mail($to, $subject, $message, $headers)){ // sending mail
print('&mail=1'); //succes
} else {
print('&mail=0');//failure
}
?>
Código XML:
Ver original<?xml version="1.0" encoding="utf-8"?>
<contactFormConfiguration>
<serverProcessorType>php</serverProcessorType>
<serverProcessorFileName>contact</serverProcessorFileName>
<validateRequiredOnly>false</validateRequiredOnly>
<submitFormOnEnter>false</submitFormOnEnter>
<messageSentText>Gracias por su mensaje.</messageSentText>
<messageSentFailedText>Lo sentimos, su mensaje no puedo enviarse.</messageSentFailedText>
<formProcessingText>enviando...</formProcessingText>
<smtpServer>localhost</smtpServer>
<smtpPort>25</smtpPort>
<plainText>false</plainText>
<emailFromSource>3</emailFromSource>
<subjectSource>Contact Form from your site</subjectSource>
<validationErrorMessages>
<message type="fieldIsRequired">{LABEL} is required.</message>
<message type="emailNotValid">{LABEL} - is not valid email address.</message>
<message type="minCharsLimitError">{LABEL} - The specified number of characters in a field is less than a required minimum.</message>
<message type="reqExpError">{LABEL} - The specified string does not match with the regular expression.</message>
<message type="biggerThanMaxError">{LABEL} - The specified number is greater than an acceptable biggest number for this field.</message>
<message type="lowerThanMinError">{LABEL} - The specified number is lower than an acceptable lowest number for this field.</message>
<message type="notANumberError">{LABEL} - The data is not a number.</message>
<message type="negativeError">{LABEL} - The specified number must not be negative.</message>
<message type="minRequirementError">{LABEL} - The minimum number of variants is not selected</message>
<message type="maxRequirementError">{LABEL} - The number of variants selected exceeds the maximum</message>
<message type="shouldBeEqualError">{LABEL} - values do not match</message>
<message type="dateIsNotValidError">{LABEL} - date has wrong format</message>
</validationErrorMessages>
</contactFormConfiguration>
Código XML:
Ver original<?xml version="1.0" encoding="utf-8"?>
<contactFormStructure>
<formItems>
<item id="1" label="Name" required="true">
<textToShow>Nombre*:</textToShow>
</item>
<item id="2" label="Phone">
<textToShow>Teléfono:</textToShow>
<restrict>+-.0-9</restrict>
</item>
<item id="3" label="E-mail" required="true">
<textToShow>E-mail*:</textToShow>
<validator>EmailValidator</validator>
</item>
<item id="4" label="Message" required="true">
<textToShow>Mensaje*:</textToShow>
</item>
</formItems>
</contactFormStructure>