Page 1 of 3
Email on New Entry
Posted: Mon Apr 22, 2013 11:49 am
by JFW Consultants
Script URL:
http://www.sawbridgeworthfirebrigade.co.uk/guestbook
Version of script: 1.7
Hosting company:
http://freeola.com/
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: email, admin email
Write your message below:
I had been working on the version of Guestbook that was Version: 1.3.2 from 27th December 2004 since first installing and using it. However, due to recent abuse I have upgraded to the latest version 1.7. Because previously I had some abuse I had changed a lot of the folder/file names so decided not to do straight upgrade and I have installed the 1.7 version with all the standard folder/file names Except the 'entries.txt' file. Everything is working absolutely fine EXCEPT when a new entry is made the script does not send me an email notification. I have checked all the settings obviously and the entered email address in 'settings.php'. Previously with the original script the function worked fine. Can anyone offer any suggestions please?
Re: Email on New Entry
Posted: Mon Apr 22, 2013 12:36 pm
by Henrie
Hello,
In the
settings.php file did you set
Code: Select all
/* Send you an e-mail when a new entry is added? 1 = YES, 0 = NO */
$settings['notify']=1;
?
Greetings,
Henrie
Re: Email on New Entry
Posted: Mon Apr 22, 2013 1:25 pm
by JFW Consultants
Henrie,
I appreciate your help but the setting you have shown is already set to that. It is a bit of a mystery as to why the email function is not working when in the original script it was working fine.
John
Re: Email on New Entry
Posted: Mon Apr 22, 2013 5:38 pm
by Henrie
That is really weird.
I should check another time if you have entered your e-mail address correctly. Because Gbook 1.7 uses the same e-mail function as Gbook 1.32 did. Just a slightly different syntax.
GBook 1.7 line 953
Code: Select all
mail($settings['admin_email'],$lang['t41'],$message,"Content-type: text/plain; charset=".$lang['enc']);
Gbook1.33 (I do not have version 1.32) line 466
Code: Select all
mail("$settings[admin_email]","Someone has just signed your guestbook",$message);
So you could try changing the Gbook 1.7 code to
Code: Select all
mail($settings['admin_email'],$lang['t41'],$message);
even though i do not think it will make difference.
Greetings,
Henrie
Re: Email on New Entry
Posted: Mon Apr 22, 2013 7:14 pm
by JFW Consultants
Thanks again... but before I try the changes you suggest here is the line of script in the ORIGINAL version that I have been running for years..
mail("$settings[admin_email]","Someone has just signed your guestbook",$message,'From: '.$settings[admin_email], '-f '.$settings[admin_email]);
You will see that my ISP needed to add '-f ' and possibly the second entry of $settings[admin_email] to make the script work! It is so long ago now that I cannot remember and I cannot find the instruction that came from them at the time. I have been in contact with them and they say "If the issue was resolved before by adding the -f amendment, you should note that we no longer require that this is set on our servers for specific contact forms to work. Adding this, or making the same amendments as last time, would not resolve the issue with your code."
I would appreciate any further comments you may have.
By the way, I have tried making NEW entries several times but no email received AND of course checked my entries.
Re: Email on New Entry
Posted: Tue Apr 23, 2013 1:15 pm
by JFW Consultants
Henrie,
Further to my previous posts I have now tried the following versions in place of the Standard (send email) - here they are:
/* (original version 1.3) */
// mail("$settings[admin_email]","Someone has just signed your guestbook",$message);
/* (version as used by JFW in 1.3 */
mail("$settings[admin_email]","Someone has just signed the Sawbridgeworth Fire Brigade Guestbook",$message,'From: '.$settings[admin_email], '-f '.$settings[admin_email]);
/* Could Try (offered by Henrie PHPJunkyard */
// mail($settings['admin_email'],$lang['t41'],$message);
/* (Default version 1.7) */
// mail($settings['admin_email'],$lang['t41'],$message,"Content-type: text/plain; charset=".$lang['enc']);
The Guestbook runs fine with any of these substituted in place of the Normal line of code but I still receive no email for a new entry!
There must surely be a good reason for this? I have the setting for sending an email to the person placing the comment as disabled :
/* Notify visitor when you reply to his/her guestbook entry? 1 = YES, 0 = NO */
$settings['notify_visitor']=0;
Presumably this would not have any bearing on the other setting?
Any further thoughts on this would be most welcome.
Kind regards.
John
Re: Email on New Entry
Posted: Tue Apr 23, 2013 5:47 pm
by Klemen
The default code should work on any server with correctly setup PHP mail command.
I would recommend taking a step back and testing if you can get such an "as simple as it gets" script to send email on your server:
Code: Select all
<?php
mail('you@yourmail.com', 'Test email', 'Test email message goes here.');
?>
Re: Email on New Entry
Posted: Tue Apr 23, 2013 6:51 pm
by JFW Consultants
Thanks Klemen,
I am no PHP guru so what I have done with your "as simple as it gets" code is create a new php blank page and put the code (with my own email address where indicated) into the code of the page, uploaded the page to the server and opened the page in my browser. I assume that is what you mean. So far nothing has happened! The curious thing is though that while the Original script was on the server it was fine for all those years!
My appreciation for your help so far.
John
Re: Email on New Entry
Posted: Tue Apr 23, 2013 8:32 pm
by Klemen
Yes, that is exactly what I meant, sorry for not being clear enough.
The code I posted should be enough for an email to be sent by PHP on a correctly setup server.
Since no email arrived I would recommend contacting your hosting company and asking them what are the requirements/restrictions with sending mail using PHP scripts.
You can show them the test code you used and inquire as to why it doesn't work on their server (it doesn't necessarily mean something is wrong with the server, they just might have special requirements).
Once we can successfully send a test mail from a simple test script it should be easy to do so from GBook as well.
Re: Email on New Entry
Posted: Wed Apr 24, 2013 8:59 am
by JFW Consultants
Many thanks once more Klemen. I will do that and respond again when I get an answer.
John
Re: Email on New Entry
Posted: Wed Apr 24, 2013 10:55 am
by JFW Consultants
Klemen,
I have now had a reply from Freeola the ISP as as follows:
"Dear John Wright,
Thank you for providing me with the information.
There are no special qualification, or amendments that are required to send via our servers, and I can not see any reason why your code should not be functioning.
If your wishing to use a simple code for a contact form, it may be worth using this guide (or at least perusing it) we have (
http://freeola.com/support/webspace-contact-form.html), as it accurately details how to use our own server script to produce a contact form on your site. As the code was written by ourselves, we can ensure that it works."
I have had a look at the code they show under the link above but as you can see they don't seem to understand why that Simple Code you provided does not work! I don't know if you would like to have a look at that link they have given to see if it offers any clues to this problem?
Kind regards.
John Wright
Re: Email on New Entry
Posted: Wed Apr 24, 2013 1:17 pm
by Klemen
I was afraid that would be the answer, yes
Do you perhaps have a copy of "form_to_mail.php" on the server somewhere, we could check that file to see how they have it setup there.
Re: Email on New Entry
Posted: Wed Apr 24, 2013 1:42 pm
by JFW Consultants
This is the Freeola Form-To-Mail form code that they show as their standard basic form for users to copy. I hope this gives a few clues.
Regards. John
=================================================
-------------- Highlight the following code, then copy & paste it into your page -------------
<html>
<head>
<title>Example Form</title>
</head>
<body>
<!-- Begin the form. Change "
www.example.com" to your web address throughout this file. -->
<form method="post" action="
http://www.example.com/cgi-bin/form_to_mail.php">
<!-- Who to send this form to. Add your e-mail address here. -->
<input type="hidden" name="recipient" value="your_email_address_here">
<!-- Where you want your mail to appear as having been sent from (this must be a valid Freeola hosted e-mail address) -->
<input type="hidden" name="from" value="your_form@your_domainname_here">
<!-- Set a subject for the form for your reference -->
<input type="hidden" name="subject" value="Comments">
<!-- List of required fields, separated by commas -->
<input type="hidden" name="require" value="name,e-mail,message">
<!-- Success redirect - where to go after the form has been sent -->
<input type="hidden" name="success_redirect" value="
http://www.example.com/thankyou_page_here">
<!-- Display our form -->
<table width="500" align="center" border="0">
<tr>
<td width="70" valign="top">
<font face="verdana" size="2">
<b>Name:</b>
</font>
</td>
<td>
<input type="text" size="40" name="name">
</td>
</tr>
<tr>
<td width="70" valign="top">
<font face="verdana" size="2">
<b>E-mail:</b>
</font>
</td>
<td>
<input type="text" size="40" name="e-mail">
</td>
</tr>
<tr>
<td width="70" valign="top">
<font face="verdana" size="2">
<b>Message:</b>
</font>
</td>
<td>
<textarea cols="40" rows="7" wrap="virtual" name="message"></textarea>
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" name="submit" value="Send">
<input type="reset" name="reset" value="Reset">
</td>
</tr>
</table>
<!-- Close form tag -->
</form>
<!-- Close body -->
</body>
<!-- End of page -->
</html>
============================================
Re: Email on New Entry
Posted: Wed Apr 24, 2013 3:08 pm
by Klemen
This is HTML code, not FTP.
If you login to your server over FTP, can you find a file called "form_to_mail.php" anywhere (probably inside "cgi-bin")?
Re: Email on New Entry
Posted: Thu Apr 25, 2013 10:43 am
by JFW Consultants
Klemen,
cgi-bin is empty on this web site location. The "form_to_mail .php" is as I downloaded and copied above in my last post.
John