Page 1 of 2
The "From" field is whacked
Posted: Fri Nov 03, 2006 6:41 pm
by pcinfoman
Script URL: Behind a Password
Version of script: 1.43
Hosting company: Netwrk Solutions
Write your message below:
I got this script installed and all is working fine. However, when I get a notification email, it says it is from "328033.334070".
Whats with that? How do i tell it to put in the contents of the "Name" field?
Posted: Fri Nov 03, 2006 11:07 pm
by Klemen
Unless you have been editing the gbook.php the name field should display without problems...
Posted: Fri Nov 03, 2006 11:45 pm
by pcinfoman
It displays just fine on the comments page, but when an email is sent the "from" field in the email is wierd.
I have not edited the code except to change the text that displays the work "Guestbook" to display "Comment" instead.
Posted: Sat Nov 04, 2006 1:21 am
by Klemen
Does it do the same if you use the ORIGINAL gbook.php file (backup your edited one, upload the original one and test it)?
Posted: Sat Nov 04, 2006 3:06 pm
by pcinfoman
I don't know. I will try that.
Posted: Mon Nov 06, 2006 6:28 pm
by pcinfoman
OK, I just uploaded a totally clean (untouched) copy of gbook.php and after filling out the form, it sent me an email.
The exact same thing happened. The email is from "
328066.334270@vux.bos.netsolhost.com".
The EXACT email looks like this (headers and all)
---------------------------------------------------
Return-Path: <
328066.334270@vux.bos.netsolhost.com>
Delivered-To: admin@328066.385143
Received: (qmail 15685 invoked by uid 78); 6 Nov 2006 18:26:07 -0000
Delivered-To:
animalmakers.com-admin@animalmakers.com
Received: (qmail 15661 invoked by uid 78); 6 Nov 2006 18:26:07 -0000
Received: from unknown (HELO ns-mr7.netsolmail.com) (10.49.16.166)
by mail2.lb.hosting.dc2.netsol.com with SMTP; 6 Nov 2006 18:26:07 -0000
Received: from vux.bos.netsolhost.com (vux.bos.netsolhost.com [205.178.145.65])
by ns-mr7.netsolmail.com (8.13.6/8.13.6) with ESMTP id kA6IQ6Bb018967
for <
admin@animalmakers.com>; Mon, 6 Nov 2006 13:26:06 -0500
Received: from vux16.prod.netsolhost.com (localhost [127.0.0.1])
by vux.bos.netsolhost.com (8.13.7/8.13.7) with ESMTP id kA6IQ6fo013909
for <
admin@animalmakers.com>; Mon, 6 Nov 2006 13:26:06 -0500
Received: (from 328066.334270@localhost)
by vux16.prod.netsolhost.com (8.13.7/8.13.7/Submit) id kA6IQ6OR013908;
Mon, 6 Nov 2006 13:26:06 -0500
Date: Mon, 6 Nov 2006 13:26:06 -0500
From: "328066.334270" <
328066.334270@vux.bos.netsolhost.com>
Message-Id: <
200611061826.kA6IQ6OR013908@vux16.prod.netsolhost.com>
To:
admin@animalmakers.com
Subject: Someone has just signed your guestbook
Hello!
Someone has just signed your guestbook!
Name: test
From: test
E-mail:
test@test.com
Website:
Message (without smileys):
Test
Visit the below URL to view your guestbook:
[
I have hidden the url]
End of message
---------------------------------------------------
Ideas?
Posted: Mon Nov 06, 2006 9:01 pm
by FruitBeard
Hi, that possibly could be because that is who infact sent you the email.
You must have been a spam target.
Posted: Mon Nov 06, 2006 9:57 pm
by Klemen
Ah, now I get it. That is the default "FROM" address your host has set for sending e-mails from user "Nobody" (used for example by PHP scripts).
You don't have to worry about it at all, it's just a (strange) configuration, but if it bothers you that much you can change line 666 from
Code: Select all
mail("$settings[admin_email]","Someone has just signed your guestbook",$message);
to
Code: Select all
mail("$settings[admin_email]","Someone has just signed your guestbook",$message,"From:you@yourmail.com");
inside gbook.php (replace
you@yourmail.com with any e-mail address you wish, for example "From:
gbook_entries@yourdomain.com").
Posted: Tue Nov 07, 2006 12:10 am
by pcinfoman
Thank you fro this. It is not that it bothers me so much but it bothers the people that get the emails. I am tired of hearing about it. I will implement this and see how it goes.
Again, thank you.
Posted: Mon Nov 19, 2007 6:39 pm
by kloomis
I ran into this same problem with those strange from email addys on the notify emails.
Here is what I tried.
The 'setting's file contains the config for gbook. The 'admin_email' is set here:
Code: Select all
/* Your e-mail. Only required if $settings['notify'] is set to 1 */
$settings['admin_email']=' \"Ken Loomis\" <username@domain.com>';
I added these to the settings.php file:
Code: Select all
/* The 'From' e-mail. Only required if $settings['notify'] is set to 1 */
$settings['gbook_email']=' \"Gbook Admin\" <gbookadmin@AaronLoomis.com>';
/* The 'Reply' e-mail. Only required if $settings['notify'] is set to 1 */
$settings['reply_email']=' \"Gbook Admin\" <gbookadmin@AaronLoomis.com>';
Then in the actual gbook.php file, I added this:
Code: Select all
$headers = 'From: $settings['gbook_email'] ' . "\r\n" .
'Reply-To: $settings['reply_email'] ' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
Then I modified the mail statement to this:
Code: Select all
mail("$settings[admin_email]","Someone has just signed your guestbook",$message,$headers);
But that just generates errors. I am pretty sure it's because I don't understand the syntax in the $header assignment statement, because it all works if I set $headers with this:
Code: Select all
$headers = 'From: webmaster@AaronLoomis.com' . "\r\n" .
'Reply-To: kloomis@bigplanet.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
BTW: This last piece of code came directly from the php manual page for mail.
I could leave it at that, but I hate hard coding things like that into a script. I just don't know php well enough to know how to write that assignment.
any help would be appreciated
Thanks,
Ken Loomis
Posted: Mon Nov 19, 2007 7:37 pm
by Klemen
You have to be careful with all the quotes. Variables are not parsed within single quotes ('). Try with:
Code: Select all
$headers = 'From: '.$settings['gbook_email']."\r\n" .
'Reply-To: '.$settings['reply_email']."\r\n".
'X-Mailer: PHP/'.phpversion();
Posted: Mon Nov 19, 2007 8:06 pm
by kloomis
Thank you, Klemen.
That solved the problem with that assignment statement. I'll have to look at that more closely to see what I was doing wrong. I tried every configuration I could think of with those quotes. But obviously not the right one.
I did run into another problem after fixing that.
Using this to set the from email in the settings file:
Code: Select all
/* The 'From' e-mail. Only required if $settings['notify'] is set to 1 */
$settings['gbook_email']=' \"Gbook Admin\" <gbookadmin@AaronLoomis.com>';
Resulted in an email addy that looked like this:
\"Gbook Admin\ <
gbookadmin@AaronLoomis.com>
I had to change that to this to make it work:
Code: Select all
/* The 'From' e-mail. Only required if $settings['notify'] is set to 1 */
$settings['gbook_email']=' "Gbook Admin" <gbookadmin@AaronLoomis.com>';
Which at first glance is pretty confusing since I had patterned that exactly like this:
Code: Select all
/* Your e-mail. Only required if $settings['notify'] is set to 1 */
$settings['admin_email']=' \"Ken Loomis\" <kloomis@BigPlanet.com>';
If anyone can explain that I'd be grateful.
Thanks,
Ken Loomis
Posted: Mon Nov 19, 2007 8:56 pm
by Klemen
You need to escape quotes " with a backslash \ if you are using quotes within quotes. For example:
" \"Ken Loomis\" <
kloomis@BigPlanet.com>"
But if you are using quotes " within single-quotes ' you omit the \, like this:
' "Ken Loomis" <
kloomis@BigPlanet.com>'
If you on the other hand use single-quotes within single-quotes you need to escape those, for example
' \'Ken Loomis\' <
kloomis@BigPlanet.com>'
These are PHP rules, I suggest you find some PHP tutorials when working.
Posted: Mon Nov 19, 2007 9:08 pm
by kloomis
Thanks again, Klemen.
From what you described, as I understand it, the original code in gbook is wrong.
Here is the original code from the gbook settings file:
Code: Select all
/* Your e-mail. Only required if $settings['notify'] is set to 1 */
$settings['admin_email']=' \"Ken Loomis\" <kloomis@BigPlanet.com>';
Which I think, if I understand you correctly, should be:
Code: Select all
/* Your e-mail. Only required if $settings['notify'] is set to 1 */
$settings['admin_email']=' "Ken Loomis" <kloomis@BigPlanet.com>';
Is that right?
Also, can you explain the why and what for of using single versus double quotes?
I will take your advise and do some tutorials on php. I have done a lot of programming in the past, BASIC, FORTRAN, Pascal, COBOL, even Forth, but usually just modify scripts when working with Perl, Javascript or php. Unfortunately when I was in school, I just missed the C++ revolution.
Thanks,
Ken Loomis
Posted: Mon Nov 19, 2007 9:25 pm
by Klemen
That's the one to use, yes.
The original settings file has
Code: Select all
$settings['admin_email']='you@yourdomain.com';
For double vs single quotes there's a lot here:
http://php.net/types.string
Had to learn Fortran for a year myself, but I left it in the last century
