changing email address of notification email

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
joshau
Posts: 2
Joined: Mon Jun 29, 2009 1:45 am

changing email address of notification email

Post 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.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post 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");
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
joshau
Posts: 2
Joined: Mon Jun 29, 2009 1:45 am

Post by joshau »

Thank you very much. You sir are a genius. :D
cyberdyne
Posts: 7
Joined: Mon Nov 02, 2009 4:54 pm

Post 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.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Have you tried the hack for v1.6? Should work just fine.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
cyberdyne
Posts: 7
Joined: Mon Nov 02, 2009 4:54 pm

Post 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
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post 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
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
cyberdyne
Posts: 7
Joined: Mon Nov 02, 2009 4:54 pm

Post 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.
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post 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
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
itsmir
Posts: 4
Joined: Sun Mar 25, 2012 9:01 am

Re: changing email address of notification email

Post 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
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: changing email address of notification email

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
itsmir
Posts: 4
Joined: Sun Mar 25, 2012 9:01 am

Re: changing email address of notification email

Post by itsmir »

That did the trick - many thanks!
Post Reply