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 [email protected]";
// 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
https://forums.phpfreaks.com/topic/29859-mail/
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
https://forums.phpfreaks.com/topic/29859-mail/#findComment-137202
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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