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
https://forums.phpfreaks.com/topic/176222-send-email-after-registry/
Share on other sites

I really do not know how to honestly.

 

Can you help me integrate it into this script?

 

<?php
$to = "[email protected]";
$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.

Archived

This topic is now archived and is closed to further replies.

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