Jump to content

Send email after registry


Russia

Recommended Posts

Hello I currently have this php script that when a person registers they get added to a database.

 

Code:

<?php
$date2 = date("F j Y");
$ip = $_SERVER['REMOTE_ADDR'];

require("inc/config.php");

$sql="INSERT INTO persons (Username, Password, Ip, AddedDate)
VALUES('$_POST[username]','$_POST[Password]','$ip','$date2')";
if (!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
echo "Thank You for registering.";
mysql_close()
?> 

 

What I would like to add is send email to admin when a user registers.

 

The Admin email address is in the Table named: members

The column name is: email

and the id of the admin is: 1

 

Basicly the 'Send To:' email address I want to be sent to the email address that the admin has in the mysql database and fetch it.

 

Anyone know how to add it?

Link to comment
Share on other sites

I really do not know how to honestly.

 

Can you help me integrate it into this script?

 

<?php
$to = "you@yoursite.com";
$subject = "New Registred User";
$from = $_REQUEST['email'] ;
$message = "A new user has signed up and has been added to the database";
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
?> 

 

I want the '$to' email address to be fetched from the database.

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.