User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 397,596 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,869 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

Email code problem

Join Date: Feb 2008
Location: Trinidad
Posts: 389
Reputation: maydhyam is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
maydhyam's Avatar
maydhyam maydhyam is offline Offline
Posting Whiz

Question Email code problem

  #1  
Mar 7th, 2008
Hi,
Can anyone tell me what is wrong with my code? I am trying to have an email sent to the email addy hardcoded informing the the email receiver that the info was sent into the DB...and when I do add a user, no email was sent...only the registration data was added to the DB...

function addNewOperator($Badge, $fn, $ln, $username, $password)
{
   global $conn;
   $f=strtoupper(substr ( $fn, 0 , 1 ));
   $l=strtoupper(substr ( $ln, 0 , 1 ));
   $initials=$f."".$l;
   $al="NULL";
   $q = "INSERT INTO Operators (EmployeeID,LastName,FirstName,Initials,username,password,accessLevel) VALUES ('$Badge','$ln','$fn','$initials','$username', '$password','$al')";   
   return mysql_query($q,$conn);  
      
   //sends an email notification to administrator about new account registered.
	if($al=="NULL")
	{
		$mailheaders = "From : ".'$username'."\n";
		$mailheaders = "Goodday, \n I just registered in the your Website.\n Awaiting your finalization.";
		$to = "someone@somewhere.com";
		$subject = "New Account";
	
		mail($to,$subject,$mailheaders);
	}    
}
The man who in view of gain thinks of righteousness; who in the view of danger is prepared to give up his life; and who does not forget an old agreement however far back it extends - such a man may be reckoned a complete man.
~ Confucius, The Confucian Analects
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 6:20 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC