Jump to content

Check this mail sending script


veluit06

Recommended Posts

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

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.........

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.