veluit06 Posted January 30, 2009 Share Posted January 30, 2009 hi i write one mail sending script in php, it dntknow its not coming plz check my coding and help me <----Html coding---> <input name="txtEmail" type="text" id="txtEmail" onchange="dooperation('Submit')" /> <----Ajax and value passing script----> // JavaScript Document //Comm AJEX Code// function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } //Save Client Detials// function saveFeedback() { var cEmail = document.getElementById('txtEmail').value; xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="mailrec.php"; url=url+"?&email="+cEmail; xmlHttp.onreadystatechange=stateChangedclientDet; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChangedclientDet() { if (xmlHttp.readyState==2) { document.getElementById("lblStatusMsg").innerHTML="Processing....."; } else{} if (xmlHttp.readyState==4) { document.getElementById("lblStatusMsg").innerHTML=xmlHttp.responseText; alert (xmlHttp.responseText); } else{} } //End of Save Student Detials//// //operations///// function dooperation(opr) { if (opr == 'Submit') { saveFeedback(); } else{} } //End Operations///////// <--------PHP Script--------> <?PHP $email = $_GET['email']; $to = "[email protected]"; $subject = "Email Id"; $body = "Email " . $email . "\n" ; if (mail($to, $subject, $body)) { echo("Message successfully sent!"); } else { echo("Message delivery failed..."); } ?> Link to comment https://forums.phpfreaks.com/topic/143086-check-this-mail-sending-script/ Share on other sites More sharing options...
revraz Posted January 30, 2009 Share Posted January 30, 2009 Try adding a FROM: header to your mail function. Link to comment https://forums.phpfreaks.com/topic/143086-check-this-mail-sending-script/#findComment-750431 Share on other sites More sharing options...
veluit06 Posted January 30, 2009 Author Share Posted January 30, 2009 hi friend i tried with from also, actually one text box and button, inside the textbox am using onchange event, using onchange event i receiving textbox values to my id, after clicking button confirmation message is sent to email entered person, everything working fine but textbox value is not coming......... Link to comment https://forums.phpfreaks.com/topic/143086-check-this-mail-sending-script/#findComment-750441 Share on other sites More sharing options...
landavia Posted January 30, 2009 Share Posted January 30, 2009 this script aren't should use AJAX.. well.. to be honest if (mail($to, $subject, $body)) { echo("Message successfully sent!"); } else { echo("Message delivery failed..."); } in my own script.. this are failed ??? but when i type this $stat=mail($mailto,$mailsbj,$mailmsg, $headers); it work? Link to comment https://forums.phpfreaks.com/topic/143086-check-this-mail-sending-script/#findComment-750470 Share on other sites More sharing options...
veluit06 Posted January 30, 2009 Author Share Posted January 30, 2009 using ajax only i done feedback form also, everything is working, but this part only is not working, i mean, user received a mail, but for me i cant able to get that user mail id, if any possible way plz tel me friends Link to comment https://forums.phpfreaks.com/topic/143086-check-this-mail-sending-script/#findComment-750474 Share on other sites More sharing options...
landavia Posted January 30, 2009 Share Posted January 30, 2009 >>but for me i cant able to get that user mail id, if any possible way please tel me friends sry.. i mixed up here u said about to get user mail id? but i don't see any in your page contain script to save user mail id? Link to comment https://forums.phpfreaks.com/topic/143086-check-this-mail-sending-script/#findComment-750720 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.