garydt Posted April 8, 2007 Share Posted April 8, 2007 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 More sharing options...
metrostars Posted April 8, 2007 Share Posted April 8, 2007 the order goes mail("To", "Subject", "Message", Additional headers); $from must also be "From: " . $row_recordset2['usnm'] and must be an email address. a name will not suffice. Link to comment https://forums.phpfreaks.com/topic/46115-still-having-trouble-with-email/#findComment-224074 Share on other sites More sharing options...
garydt Posted April 8, 2007 Author Share Posted April 8, 2007 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'] Link to comment https://forums.phpfreaks.com/topic/46115-still-having-trouble-with-email/#findComment-224101 Share on other sites More sharing options...
garydt Posted April 8, 2007 Author Share Posted April 8, 2007 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? Link to comment https://forums.phpfreaks.com/topic/46115-still-having-trouble-with-email/#findComment-224138 Share on other sites More sharing options...
PC Nerd Posted April 8, 2007 Share Posted April 8, 2007 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 https://forums.phpfreaks.com/topic/46115-still-having-trouble-with-email/#findComment-224141 Share on other sites More sharing options...
garydt Posted April 8, 2007 Author Share Posted April 8, 2007 Thanks, How do i send it from the local server? Link to comment https://forums.phpfreaks.com/topic/46115-still-having-trouble-with-email/#findComment-224180 Share on other sites More sharing options...
garydt Posted April 8, 2007 Author Share Posted April 8, 2007 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 Link to comment https://forums.phpfreaks.com/topic/46115-still-having-trouble-with-email/#findComment-224226 Share on other sites More sharing options...
per1os Posted April 8, 2007 Share Posted April 8, 2007 Try setting the username to this: pop3_username= garydt88 and see what comes from it. Link to comment https://forums.phpfreaks.com/topic/46115-still-having-trouble-with-email/#findComment-224234 Share on other sites More sharing options...
garydt Posted April 8, 2007 Author Share Posted April 8, 2007 Thanks. Tried that, still no joy. What else can i try? Link to comment https://forums.phpfreaks.com/topic/46115-still-having-trouble-with-email/#findComment-224256 Share on other sites More sharing options...
garydt Posted April 8, 2007 Author Share Posted April 8, 2007 Can anyone help please? Link to comment https://forums.phpfreaks.com/topic/46115-still-having-trouble-with-email/#findComment-224347 Share on other sites More sharing options...
garydt Posted April 8, 2007 Author Share Posted April 8, 2007 bump Link to comment https://forums.phpfreaks.com/topic/46115-still-having-trouble-with-email/#findComment-224464 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.