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 = garydt88@tiscali.co.uk

 

 

<?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 = "garydt88@tiscali.co.uk";
$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
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 = "garydt88@tiscali.co.uk";
$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']

 

Link to comment
Share on other sites

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 garydt88@tiscali.co.uk 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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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= garydt88@tiscali.co.uk

pop3_password= garytanner

 

I'm still getting error-

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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