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>

Im not sure but I think you cant send mail from a home made server like apache, etc.

I guess if you wanted to you might have to hand out some cash and make your localhost a full fledge server, which you may or may not be inclined on doing.

Im not sure but I think you cant send mail from a home made server like apache, etc.

I guess if you wanted to you might have to hand out some cash and make your localhost a full fledge server, which you may or may not be inclined on doing.

All you need is to set up an SMTP server. Most linux distros come with 'sendmail' installed which is probably the most popular. I have no idea how to do it in Windows.

Grew up on windows need to start showing some love to unix :|

But if he made his computer a SMTP that would mean his computer would have to be on everytime the website required to send it?

So if its just for self use it is fine, but if it was meant to be a 24/7 thing he would have to keep his computer on?

Also where would get a SMTP?

$to = "Your gmail id";
$from = "yahoo id";
$subject = "Success msg";
$sendmail = @mail($to,$subject,$body,"From: $from\nContent-Type: text/html; charset=iso-8859-1");

When you use xampp and mercury
1> Start xampp and mercury do not close mercury window.
To get mail from local to mail i.e (yahoo,gmail)
it take long time duration...may be it come in spam

This article has been dead for over six months. Start a new discussion instead.