Vivid Lust Posted November 5, 2008 Share Posted November 5, 2008 Hey all! I made this mail script, although not receiving any emails, help appreciated! <?php //connect to mysql $link = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); //connect to db mysql_select_db($dbname,$link) or die ('Error connecting to mysql') or die(mysql_error()); $mail = $_POST['email']; $sub = $_POST['subject']; $msg = $_POST['message']; //get info about user from database $sql = "SELECT * FROM exchange WHERE id=( \"$id\" )"; $query=mysql_query($sql, $link) or die(mysql_error()); while($row=mysql_fetch_assoc($query)){ $user_email = $row['email']; } if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) { if( $mail == "" || $sub == "" || $msg == ""){ header('location:email.php?msg=2&id='.$id); exit; } //define the receiver of the email $to = $user_email; //define the subject of the email $subject = $sub; //define the message to be sent. Each line should be separated with \n $message = $msg; //define the headers we want passed. Note that they are separated with \r\n $headers = "From: ".$mail."\r\nReply-To: ".$mail; //send the email mail($to, $subject, $message, $headers, "-f$e"); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" header("Location:success2.php"); }else{ header('location:email.php?msg=1&id='.$id); } unset($_SESSION['security_code']); ?> Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/131529-mail-script-not-working/ Share on other sites More sharing options...
rhodesa Posted November 5, 2008 Share Posted November 5, 2008 so, with this, are you trying to set the envelope sender? "-f$e" it shouldn't be needed, try removing that Link to comment https://forums.phpfreaks.com/topic/131529-mail-script-not-working/#findComment-683111 Share on other sites More sharing options...
Vivid Lust Posted November 5, 2008 Author Share Posted November 5, 2008 Ah, thanks for pointing that out, variable $e doesnt exist Link to comment https://forums.phpfreaks.com/topic/131529-mail-script-not-working/#findComment-683124 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.