hi there,
I'm trying to create a function to send email from localhost(postmaster@localhost) to other email accounts(yahoomail,gmail,hotmail).I'm currently using xampp and the mercury32 inside xampp.I had successfully sent email from localhost to localhost but I can't make it to send outside from localhost. This is the code and it works perfectly sending email from localhost to localhost.
<?php
//Check whether the submission is made
if(isset($_POST['Submit'])){
//Declarate the necessary variables
$mail_to=$txtEmailto2;
$mail_from=$txtEmailfrm2;
$mail_sub=$txtSub2;
$mail_mesg=$txtMsg;
//Check for success/failure of delivery
if(mail($mail_to,$mail_sub,$mail_mesg,"From:$mail_from/r/nReply-to:$mail_from"))
echo "<span class='red'>E-mail has been sent successfully from $mail_to to $mail_from</span>";
else
echo "<span class='red'>Failed to send the E-mail from $mail_to to $mail_from</span>";
}
?>
<html>
<body>
<form name="frmsendmail" method="post" action="" onSubmit="return ValidationForm()">
<table width="100%" border="0">
<tr>
<td width="33%" align="right" class="text">To :
<td width="67%"><input name="txtEmailto2" type="text" class="input" id="txtEmailto22" size="30" maxlength="100">
</tr>
<tr>
<td align="right" class="text">From :
<td><input name="txtEmailfrm2" type="text" class="input" id="txtEmailfrm22" size="30" maxlength="100">
</tr>
<tr>
<td align="right" class="text">Subject :
<td><input name="txtSub2" type="text" class="input" id="txtSub22" size="30" maxlength="100">
</tr>
<tr>
<td align="right" class="text">Mesage(body) :
<td><textarea name="txtMsg" cols="50" rows="10" class="input" id="textarea"></textarea>
</tr>
<tr>
<td align="right"><input name="hidSubmit" type="hidden" id="hidSubmit" value="true">
<input name="Submit" type="submit" class="input" value="Send">
<td><input name="Submit2" type="reset" class="input" value="Reset">
</tr>
</table>
</form>
</body>
</html>