Seite 1 von 1

email to admin at register and guestbook

Verfasst: 3. Februar 2009, 16:39
von jeweetzelluf
Hi all!

My site with Easyhp is almost finished, just have to get two more things done.

I want to receive an email when a new member has registered, and when a new post in the guestbook has been done.

Which files should i edit for this?

For the guestbook i think i should be under this line?

guestbook.php

Code: Alles auswählen

if ($mode == "save" OR $mode == "save_new") {
Thnx, Tony

Re: email to admin at register and guestbook

Verfasst: 3. Februar 2009, 18:11
von daniel
jeweetzelluf hat geschrieben:For the guestbook i think i should be under this line?

guestbook.php

Code: Alles auswählen

if ($mode == "save" OR $mode == "save_new") {
Hy Tony,
Better is when you insert the code under this:

Code: Alles auswählen

if (mysql_query($query[save]) == true) {
and under this:

Code: Alles auswählen

if (mysql_query($query[save_new]) == true) {
Else the mail has send when the post has an error, too.

and in the register.php, you can insert the function over this:

Code: Alles auswählen

mail ($to, $subject, $message, $headers);
(this is the activationmail to the user).

For send mail is this funtion:

Code: Alles auswählen

mail(to-adress, subject, message, headers)
the headers is optional.

But by the registration please not send the aktivationmail. in The mail is the password of the user-account. and this ist only for the user and not for the administrator ;)

You can make your mail so:

Code: Alles auswählen

$adminmessage = "username:".$username ."\n Email:".$email; 
mail ("admin@domain.de", $subject, $adminmessage, $headers);
the /n is for the linebreak/Return. if the /n the wrong string you must \n use for the linebreak/Return

Re: email to admin at register and guestbook

Verfasst: 3. Februar 2009, 18:14
von EasyHP
Yeah, this is the correct position for adding code when a guestbook has been posted. If you want to receive an email after any user registered a new account, add your code after this:

Code: Alles auswählen

if (mysql_query($query[reg_user]) == true) {
Best regards,
Tim