Jump to content

Mail()


Chocolate570

Recommended Posts

How do I set the outgoing mail server and account and all the stuff needed to send an email? Here's my current script, which thinks it has sent the email but doesn't:

<?php$system = "PHPRULES";require("common.php");head("*","","News",""); $to="chocolate570@gmail.com"; if (!isset($_POST["send"])){   // no post data -> display form   ?>   <form method="POST" action="<?=$_SERVER['PHP_SELF'];?>">   <table>   <tr>   <td width="10">   To:</td> <td width="10">Chocolate570@GMail.com</td></tr>   <tr><td width="10">From:</td> <td width="10"><input type="text" name="sender"></td></tr>   <tr><td width="10">Subject:</td> <td width="10"><input type="text" name="subject"></td></tr>   <tr><td width="10">Message: </td></tr><br />   <tr><td width="10"><textarea name="message" rows="10" cols="60" lines="20"></textarea></td></tr>   <tr><td width="10"><input type="submit" name="send" value="Send"></td></tr>   </form>   <?  }else{   // found post data .. deal with it   $from=$_POST['sender'];   // send mail :   if (mail($to,$_POST['subject'],$_POST['message'],"From: $from\n")){     // display confirmation message if mail sent successfully     echo "Your mail was indeed sent to $to. It will be checked as soon as possible."; }else{   // sending failed, display error message    echo "We are sorry, your email could not be send. Try again later.";   } }tail("","",""); ?>

What am I doing wrong?

Link to comment
Share on other sites

Never mind, it works like a charm. Topic closed.

Does your code work? Did you make a change to the php server? I'd recommend posting you rsolution so others can understand.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...