Page 1 of 1
mail(); error
Posted: Mon Sep 16, 2002 3:56 am
by qads
hi,
i am useing
Code: Select all
mail("$email","$getїsite_name] - Welcome","$body","From:$getїemail]";
to send emails, all the values are from either database or a form, but i get this error:
Code: Select all
Warning: Failed to Receive in c:\apache\htdocs\trial\phpauth\tmploxjs2huja.php on line 112
i don't have a file called tmploxjs2huja
i have searched php.net but have't found any thing, please help.
also what is the best way to send emails, both on window and *nix?
i need something that works on both with out problems.
thanks for your help
p.s. php version is PHP is 4.2.3
Posted: Mon Sep 16, 2002 9:28 am
by phice
Could you post a link to the .phps file of your .php? Or just give the code on here?
Posted: Mon Sep 16, 2002 10:58 am
by qads
well here is all of it, you should be looking at the php code which is at the bottem
Code: Select all
<?php include("admin/inc/db.inc.php");
$date = date("d/m/Y");
$siteinfo = mysql_query("SELECT `url`,`site_name`,`email` FROM `site_info`");
$get = mysql_fetch_array($siteinfo);
?>
<title><?php print("$getїsite_name]"); ?></title>
<div align="center">
<p><font size="7" face="Tahoma"><b><i>Join</i></b></font></p>
<p> </p>
</div>
<center>
<form name='form1' method='post' action=''>
<table width='262' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td width='132' height='28' valign='middle'>
<div align='right'><font size='2'><b><font face='Tahoma'> Username:</font></b></font></div>
</td>
<td width='130' valign='top'>
<input type='text' name='username'>
</td>
</tr>
<tr>
<td valign='middle' height='28'>
<div align='right'><font face='Tahoma' size='2'><b> Password:</b></font></div>
</td>
<td valign='middle'><font size="2" face="Tahoma" color="#FF0000">Will be
sent to in a email
<input type="hidden" name="join">
</font></td>
</tr>
<tr>
<td valign='middle' height='28'>
<div align='right'><b><font size='2' face='Tahoma'> Email:</font></b></div>
</td>
<td valign='top'>
<input type='text' name='email'>
</td>
</tr>
<tr>
<td height="23" valign="middle">
<div align="right"><b><font size="2" face="Tahoma">Join Mailing List?</font></b></div>
</td>
<td valign="top">
<input type="radio" name="mailing" value="1">
<font size="2" face="Tahoma"><b>Yes</b></font><br>
<input type="radio" name="mailing" value="0">
<b><font size="2" face="Tahoma">No</font> </b></td>
</tr>
</table>
<input type='submit' value=' OK! ' name='submit'>
</form>
<?php
if(IsSet($join))
{
function random_char($string)
{
$length = strlen($string);
$position = mt_rand(0, $length - 1);
return($stringї$position]);
}
function random_string ($charset_string, $length)
{
$return_string = random_char($charset_string);
for ($x = 1; $x < $length; $x++)
$return_string .= random_char($charset_string);
return($return_string);
}
mt_srand((double)microtime() * 1000000);
$charset = "abcdefghijklmnopqrstuvwxyz1234567890ABCDE_FGHIJKLMNOPQRSTWXYZ";
$charset1 = "abcdefghijklmnopqrstuvwxyz1234567890ABCDE_FGHIJKLMNOPQRSTWXYZ";
$password = random_string($charset, 6);
$login_code = random_string($charset1, 6);
$Epassword = MD5($password);
if(Empty($username))
{
print("Please Fill in all the fields<br>");
exit;
}
if(Empty($email))
{
print("Please Fill in all the fields<br>");
exit;
}
else
{
$check = mysql_query("SELECT `username` FROM `users` WHERE 1 AND `username` LIKE '$username'");
$records = mysql_num_rows($check);
if($records > 0)
{
print("$username is already in use, please choose a differnet username...");
}
else
{
$query1 = "INSERT INTO `users` (`username`, `password`, `email`, `mailing_list`, `date`, `last_login`, `pass`, `login_code`) VALUES ('$username', '$Epassword', '$email', '$mailing', '$date', '00/00/00', '$password', '$login_code')";
$in = mysql_query($query1) or die ("Unable to Insert new Member...plase contact the webmaster...");
print("Welcome to $getїsite_name], Please check your email inbox for your password and other information.<br><center><br><a href="http://www.qadsscripts.t2u.com"><font size="2">Script From QadsScripts</font></a>");
$body = "
Welcome to $getїsite_name],
Here is your account information at $getїsite_name]:
Username: $username
Password: $password
To login please go to: $getїurl]
**********Please Note***************
This is not spam mail, some one asked us to send this information on this email address.
**********Thank You************
*******Script From Qadsscripts.t2u.com*********";
mail("$email","$getїsite_name] - Welcome","$body","From:$getїemail]");
}
}
}
?>
Posted: Mon Sep 16, 2002 7:22 pm
by qads
bah....no one knows
well..here is what's wrong:
in php.ini i did't set the smtp host, as soon as fixed that, it started working!
Posted: Tue Sep 17, 2002 1:03 am
by Takuma
lol, check your configuration before the code

Posted: Tue Sep 17, 2002 5:55 am
by qads
lol, the problem was that it was't my server, someone else owns it, so i had no way of knowing that, so just for the heck of it, i removed the smtp line to see if i will get the same error...and i did

Posted: Tue Sep 17, 2002 10:55 am
by Takuma
Is it a shared hosting? Or it's just your friend's? I still haven't manage to to set my SMTP server on my server

Posted: Tue Sep 17, 2002 11:03 am
by qads
no, it was one of the users from my site
