Jump to content

Still having trouble with email


garydt

Recommended Posts

I'm trying to get the website to email me some values but i get error-

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files\xampp\htdocs\epeople\regcomplete.php on line 48

This is in the php.ini-

[mail function]

; For Win32 only.

SMTP = smtp.tiscali.co.uk

smtp_port = 25

 

; For Win32 only.

sendmail_from = [email protected]

 

 

<?php require_once('Connections/elvisdb.php'); ?>
<?php
session_start();

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
$user = ($_SESSION['MM_Username']);

$colname_Recordset1 = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_elvisdb, $elvisdb);
$query_Recordset1 = sprintf("SELECT * FROM images WHERE usnm = '$user'", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $elvisdb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$from = $row_Recordset2['usnm'];
$photo = $row_Recordset2['imageName'];
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$to = "[email protected]";
$header = "photo";
mail($to,$from,$header,$message);

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
registration complete 
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

Link to comment
https://forums.phpfreaks.com/topic/46115-still-having-trouble-with-email/
Share on other sites

Thanks.

I changed the code to what you said but i'm still getting the same error.

mysql_select_db($database_elvisdb, $elvisdb);
$query_Recordset1 = "SELECT email FROM userinformation";
$Recordset1 = mysql_query($query_Recordset1, $elvisdb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$From = $row_Recordset2['email'];
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$user = ($_SESSION['MM_Username']);

$colname_Recordset1 = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_elvisdb, $elvisdb);
$query_Recordset1 = sprintf("SELECT * FROM images WHERE usnm = '$user'", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $elvisdb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$Message = $row_Recordset2['imageName'];
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$To = "[email protected]";
$Subject = "photo";
mail("$To", "$Subject", "$From", "$Message");

 

I also changed the php.ini -

[mail function]

; For Win32 only.

SMTP = smtp.tiscali.co.uk

smtp_port = 25

 

; For Win32 only.

sendmail_from = $row_Recordset2['email']

 

I've changed the code to-

 mail("$To", "$Subject", "$Message", "From: $From" ); 

and i get error-

Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for [email protected] in C:\Program Files\xampp\htdocs\epeople\regcomplete.php on line 55

 

Does this mean the mail server at tiscali is rejecting it?

What can i do to resolve it?

um, im pretty certain that your server is rejecting it.  are you using the right port  i dont know

 

if your using a host, contact them to ask what you can do.  im not familiar with UK companies, is it an ISP offering an email or whats the case

you whould try to simply send it from the local server.

 

 

cant think of anyting else at the moment

 

good luck

In the php.ini I put this-

[mail function]

; For Win32 only.

;SMTP = smtp.tiscali.co.uk

;smtp_port = 25

 

; For Win32 only.

sendmail_from = $From

sendmail_path = C:\Program Files\xampp\sendmail

pop3_server= pop.tiscali.co.uk

pop3_username= [email protected]

pop3_password= garytanner

 

I'm still getting error-

Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for [email protected] in C:\Program Files\xampp\htdocs\epeople\regcomplete.php on line 55

 

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.