Click to See Complete Forum and Search --> : XML contact form not working!!


TGM
03-12-2010, 10:29 AM
This is my Configuration for my contact form. I test the form with Live account address but I dont receive any email..Not even on my junk box..

..any suggestion to make it work with my live email account?


<?xml version="1.0" encoding="utf-8"?>

<contactFormConfiguration>

<emailTo>pierre_vargas@live.com</emailTo>

<serverProcessorType>php</serverProcessorType>

<serverProcessorFileName>contact</serverProcessorFileName>

<validateRequiredOnly>false</validateRequiredOnly>

<submitFormOnEnter>false</submitFormOnEnter>

<messageSentText>Thank you for your message.</messageSentText>

<messageSentFailedText>Thank you for your message.</messageSentFailedText>

<formProcessingText>processing...</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>

aj_nsc
03-12-2010, 01:03 PM
Does it work with any other email address?
Can we see the code that actually processes the form, and perhaps the form itself?

TGM
03-12-2010, 02:14 PM
This is my "contact.php"




<?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/>';

$mail_body .= ''.stripslashes($value).'<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') {

$message = str_replace('<br/>',"\r\n", $message);

$message = strip_tags($message);

//------------------------------------------------------------------
} else {
//----otherwise composing message headers---------------------------
$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\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 .= 'To: '.$to. "\r\n";

$headers .= 'From: Site visitor ' .$from. "\r\n";
//------------------------------------------------------------------


if (mail($to, $subject, $message, $headers)){ // sending mail

print('&mail=1'); //succes

} else {

print('&mail=0');//failure

}

?>







and this is my "contact.asp"







<%
'----function that removes html tags-----------
Function RemoveHTML( strText )
Dim RegEx
Set RegEx = New RegExp
RegEx.Pattern = "<[^>]*>"
RegEx.Global = True
RemoveHTML = RegEx.Replace(strText, "")
End Function
'---------------------------------------------

'------defining script vars-------------------
Dim mailObj, mailCfg, myBody, fld

Dim RegEx
set RegEx = New RegExp
'--------------------------------------------

'------getting data sent by flash (filtering configuration data)------------
For Each fld in Request.Form
If Request.Form(fld) <> "" and _
fld <> "mail_to" and _
fld <> "smtp_server" and _
fld <> "smtp_port" and _
fld <> "plain_text" and _
fld <> "mail_from" and _
fld <> "mail_subject" Then
myBody = myBody & vbCRLF & " <b>" & fld & "</b> :<br/> " & Trim(Request.Form(fld)) & "<br/>"
End If
Next
'---------------------------------------------------------------------------

'----------setting conf data------------------------------------------------
On Error Resume Next
Set myMail = CreateObject("CDO.Message")
myMail.Subject = Request.Form("mail_subject")
myMail.From =Request.Form("mail_from")
myMail.To = Request.Form("mail_to")

'--------if plain text is set to true removing html---------------------------------------
if Request.Form("plain_text") = "true" then

myMail.TextBody = RemoveHTML(myBody)

'-------otherwise composing message body--------------------------------------------------
else myMail.HTMLBody = "<html><body>" & myBody & "</body></html>"

end if
'----------setting configuration params for smtp----------------------------------------------------------------------------------
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = Request.Form("smtp_server")
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = Request.Form("smtp_port")
myMail.Configuration.Fields.Update
'---------------------------------------------------------------------------------------------------------------------------------
myMail.Send '---------------sending message

If Err = 0 Then
Response.Write("&mail=1") 'if there the message is sent return 1 to flash
Else
Response.Write("&mail=0") 'otherwise return 0
End If

%>





btw its a flash website!

aj_nsc
03-12-2010, 03:50 PM
This is not an XML question, it's an ASP one. The XML is just an interface that this script uses to be an easily customizable, off the shelf contact form.

Unless you can answer my original question if this contact form works with any other e-mail address, then post it in the ASP forum.

TGM
03-12-2010, 03:54 PM
no..it doesnt work with any other email address..I've try my hotmail and yahoo but it doesnt work!

aj_nsc
03-13-2010, 09:23 AM
My apologies on the fact thinking it was an asp issue, it looks like you've specified in the XML that you're using the PHP script....although I still have no idea what the interface is between the XML and the contact.php script is. So it's either the php script itself, or the combination of the php script and your server. ask this question in the php forum.