Page 1 of 1

changing email address of notification email

Posted: Mon Jun 29, 2009 1:54 am
by joshau
Script URL:
Version of script:
Hosting company: Webhosting Buzz
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:
Admin, email, admin email

Write your message below:

Hi there, whenever people sign my guestbook I get emailed a notification telling me of the new post. However I was wondering if I could change the email address it comes from. Currently it shows the email coming from User Josh2008 with email josh2008@buzz1.whbdns.com which looks like its getting the information from my server and my cpanel username. I want to put in a normal email address so that my spam filters dont keep sending it to junk mail. It would be much appreciated if you could tell me how to change the email it sends from.

Posted: Sun Jul 05, 2009 9:18 am
by Klemen
Try opening gbook.php in Notepad and change

Code: Select all

mail("$settings[admin_email]",$lang['t41'],$message);
to

Code: Select all

mail("$settings[admin_email]",$lang['t41'],$message,"From:you@yourmail.com\nReply-to:you@yourmail.com\nReturn-path:you@yourmail.com");

Posted: Wed Jul 08, 2009 1:04 am
by joshau
Thank you very much. You sir are a genius. :D

Posted: Fri Nov 27, 2009 2:52 pm
by cyberdyne
Can I add to this rather than starting a new thread please.

In v1.7 as opposed to v1.6 above, can I change the address the email notifications are sent from?

Currently, they are sent from the server address (mylogin@myhostname.myservername.net) which doesn't look very attractive and also exposes my control panel login name.

Thank you.

Posted: Fri Nov 27, 2009 5:27 pm
by Klemen
Have you tried the hack for v1.6? Should work just fine.

Posted: Fri Nov 27, 2009 5:43 pm
by cyberdyne
Klemen wrote:Have you tried the hack for v1.6? Should work just fine.
Is there a hack other than the above?
I looked for the above code in v1.7 of gbook.php but it was not there.

Many thanks

Posted: Fri Nov 27, 2009 7:01 pm
by Henrie
Hello cyberdyne,

I think you did not search well enough.

In gbook.php of version GBook 1.7

For the approval e-mail change line 953

Code: Select all

mail($settings['admin_email'],$lang['t41'],$message,"Content-type: text/plain; charset=".$lang['enc']);
For the notification e-mail change line 989

Code: Select all

mail($settings['admin_email'],$lang['t41'],$message,"Content-type: text/plain; charset=".$lang['enc']);
Greetings,
Henrie

Posted: Fri Nov 27, 2009 7:13 pm
by cyberdyne
Henrie wrote:Hello cyberdyne,

I think you did not search well enough.
Klemen wrote:Try opening gbook.php in Notepad and change

Code: Select all

mail("   .......
The code you posted is slightly different from the code above Henrie.

Unfortunately, I searched for the section above.

Confirmed, works perfectly!

Many thanks for your help Henrie.

Posted: Fri Nov 27, 2009 7:53 pm
by Henrie
cyberdyne wrote:The code you posted is slightly different from the code above Henrie.
You are right about that. But when i first do not find the whole line, i always do a second search for part of the line because the code might have changed in new versions. In this case i searched for t41

Greetings,
Henrie

Re: changing email address of notification email

Posted: Mon Mar 26, 2012 11:32 am
by itsmir
Hi there,

I've updated lines 953 & 989 in gbook.phpo as described above but am no longer receiving approval/notification emails - I'm sure I've done something daft - can you please check my code for stupid mistakes;-

Line 953

Code: Select all

mail($settings['admin_email'],$lang['t41'],$message,"Content-type: text/plain; charset=".$lang['enc'],"From:fanpage@whitenightevents.nl\nReply-to:fanpage@whitenightevents.nl\nReturn-path:fanpage@whitenightevents.nl");
Line 989

Code: Select all

mail($settings['admin_email'],$lang['t41'],$message,"Content-type: text/plain; charset=".$lang['enc'],"From:fanpage@whitenightevents.nl\nReply-to:fanpage@whitenightevents.nl\nReturn-path:fanpage@whitenightevents.nl");
Many Thanks in advance
Miriam

Re: changing email address of notification email

Posted: Mon Mar 26, 2012 2:13 pm
by Klemen
Try replacing

Code: Select all

['enc'],
with

Code: Select all

['enc']."\n".
If that doesn't work it's possible your server doesn't allow modifying "From" email headers.

Re: changing email address of notification email

Posted: Mon Mar 26, 2012 4:03 pm
by itsmir
That did the trick - many thanks!