email to admin at register and guestbook

In diesem Forum befinden sich alte Themen.
Gesperrt
jeweetzelluf
Inaktiv
Beiträge: 6
Registriert: 25. Januar 2009, 03:29

email to admin at register and guestbook

Beitrag 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
Benutzeravatar
daniel
Ehemaliger
Beiträge: 413
Registriert: 13. März 2008, 16:49
Wie bist du auf EasyHP gekommen?: Werbung auf phpBB.de
Wohnort: Bremen
Kontaktdaten:

Re: email to admin at register and guestbook

Beitrag 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
EasyHP
Administrator
Administrator
Beiträge: 731
Registriert: 1. April 2007, 17:42

Re: email to admin at register and guestbook

Beitrag 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
Gesperrt