Jump to content

mail();


plutomed

Recommended Posts

This bit of code all works fine up to sending the email. I don't receive it.

 

<h2>Send us an E-Mail</h2>

<?

if($_POST['name'])
{

echo "Your message has ben sent, a copy has been forwarded to your E-Mail.";

$Name = $_POST['name'];
$Email = $_POST['email'];
$Subject = $_POST['subject'];
$Message = wordwrap($_POST['message'], 70);

mail(str_replace("££", "@","me££plutomedia.net"), "Harrison Technology site - ".$Subject, $Message, "From:".$Name."<".$Email.">"."\r\n"."Reply-To:".$Email);

}

?>

<form action="/contact" method="post">
<table>
    	<tr>
        	<td><label>Name: </label></td>
            <td><input type="text" name="name" /></td>
        </tr>
        <tr>
        	<td><label>Subject: </label></td>
            <td><input type="text" name="subject" /></td>
        </tr>
        <tr>
        	<td><label>Email: </label></td>
            <td><input type="text" name="email" /></td>
        </tr>
        <tr>
        	<td><label>Message: </label></td>
            <td><textarea name="message" cols="100" rows="20"></textarea></td>
        </tr>
        <tr>
        	<td></td>
        	<td><input type="submit" value="Send" /> <input type="reset" value="Clear" /></td>
        </tr>
    </table>
</form>

Link to comment
Share on other sites

u can check if it is sent..the mail() function returns it, but it does not tell u whether it reached the destination properly or not.

 

u have to configure something like smtp to actually send mail. PHP mail() function uses it, it itself is not a mail engine.

Link to comment
Share on other sites

Add the following two lines immediately after your first opening <?php tag -

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

 

Most likely cause for your mail server to not send the email or for the receiving mail server to reject it - The From: address must be a mail box hosted at the sending mail server.

Link to comment
Share on other sites

do you have access to the mail queue?

 

if you don't, or don't know what that is, your web host does.

 

you can check the mail queue to see if the mail is placed in there, which is where it goes immediately after php executes the mail function

 

 

I see you're using the short tag <?

Have you tried using the regular <?php ?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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