Jump to content

mail()


chriscloyd

Recommended Posts

i need help the mail() is not working for me

Heres my script it goes to the correct page after which is index.php?page=finsh_add_project
but i dont get an email

[code]
<?php
include("../includes/functions.php");
include("../db.php");
if ($_POST['first'] == NULL) {
$reason = "No first name entered<br />";
header("Location: index.php?addproject&reason=$reason");
} elseif ($_POST['last'] == NULL) {
$reason = "No last name entered<br />";
header("Location: index.php?addproject&reason=$reason");
} elseif ($_POST['email'] == NULL) {
$reason = "No email address entered<br />";
header("Location: index.php?addproject&reason=$reason");
}
$password = genpassword(10);
$pass = sha1(md5($password));
$first = $_POST['first'];
$last = $_POST['last'];
$email = $_POST['email'];
$create_client = mysql_query("INSERT INTO pm_clients (`first`,`last`,`email`,`password`) VALUES ('$first','$last','$email','$pass')");
if ($create_client) {
$from    = "SRX Studios - Project Manager noreply@srxstudios.com";
// HTML body
    $body  = '<img src="http://pm.srxstudios.com/images/image1.jpg" width="500" height="60"><br>
<br><br>Hello " . $first ." ". $last . ", <p>
    <i>Your</i> info to login into the <a href="http://pm.srxstudios.com">Project Manager</a>.<p>
    Username: ".$email."<br>
Password: ".$password."<br><br><br>
    <strong>Webmaster - SRX Studios</strong><br>
. . . . . . . . . . . . . . . . . . . . . . . . . . .<BR>
<strong>SRX Studios,  LLC.</strong><strong><BR>
<a href="http://srxstudios.com">http://www.srxstudios.com</a></strong>';
if(!mail($email,$subject,$message,"From $from")) {
        echo "There has been a mail error sending to " . $email . "<br>";
} else {
$_SESSION['srxadd'] = $email;
header("Location: ../index.php?page=finsh_add_project");
}
} else {
echo "error";
}
?>[/code]
Link to comment
Share on other sites

I don't know if this is it, but the "Headers" portion (the 4th argument is not entered correctly.

Change the following:
[quote]mail($email,$subject,$message,"From $from")[/quote]

to:

[quote]mail($email,$subject,$message,"From:$from")[/quote]

And just to confirm that your server IS able to send messages try the following:

[quote]mail([b]"your_emailaddress"[/b],"Test Subject","This is a test message")[/quote]
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.