Email on New Entry

Dr. GBooky is here to help you with your guestbook problems ...
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Email on New Entry

Post by Henrie »

Hello John,

You have presented us the code for the mail form as you serve it to the visitor to fill in (as can also be found here http://freeola.com/support/form_to_mail ... xample.htm ).
In the mail form you presented us is a reference to http://www.example.com/cgi-bin/form_to_mail.php

Code: Select all

<!-- 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">
That is the php file which contains the actual mail function. Therefore we need to see the contents of that file to see how the mail function is implemented there so we can use the same function in Gbook.

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.
JFW Consultants
Posts: 23
Joined: Mon Apr 10, 2006 6:28 pm

Re: Email on New Entry

Post by JFW Consultants »

Henrie,
Sorry if I am being 'thick'! Are you saying you want me to make the changes (where indicated) in the code and load an actual copy of that up on to the server under www.sawbridgeworthfirebrigade.co.uk and then run it so that I get a reply to my entries?
My apologies if I am not understanding - you and Klemen are being most helpful!

John
JFW Consultants
Posts: 23
Joined: Mon Apr 10, 2006 6:28 pm

Re: Email on New Entry

Post by JFW Consultants »

Further to my previous post I have used the default form and supplemented with my details where necessary and uploaded it to the server. I used it and it has sent me an email reply.
The form code is as follows:
===================================================
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<html>
<head>
<title>Test Form for analysis of code</title>
</head>

<body>

<!-- Begin the form. Change "www.example.com" to your web address throughout this file. -->
<form method="post" action="http://www.sawbridgeworthfirebrigade.co ... o_mail.php">

<!-- Who to send this form to. Add your e-mail address here. -->
<input type="hidden" name="recipient" value="webmaster@sawbridgeworthfirebrigade.co.uk">

<!-- 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="john@johnfwright-consultants.co.uk">

<!-- 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.sawbridgeworthfirebrigade.co ... e_home.htm">


<!-- 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>
===================================================
Does this help?
I have had a look in the folder cgi_bin on the server but there are no files there!

Regards. John
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Email on New Entry

Post by Klemen »

This doesn't help us, because this is not the actual code that sends email, this is just HTML for the form.

Do you have *any* PHP code on the server that is successfully sending out emails? If not, you might ask your host where to find the "form_to_mail.php" script they mention in the article.
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
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Email on New Entry

Post by Henrie »

Klemen, tt does help in a way.
Because it confirms that sending e-mails is possible.
In the html code that John posted is a link to the php-file that is actually sending the e-mail
So if John either:
  1. posts the content of the file found at http://www.sawbridgeworthfirebrigade.co ... o_mail.php here in the forum, or
  2. downloads the above mentioned file through ftp, puts the form_to_mail.php file in a zip-file, uploads the zip-file to his webserver, and places a link to the zip-file in this forum
Than we can take a look at the actual code that is sending the e-mail and than we can help in further.

But if he just keeps posting the form mail html-code instead of the php-code inside the form_to_mail.php file we can not help him.

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.
JFW Consultants
Posts: 23
Joined: Mon Apr 10, 2006 6:28 pm

Re: Email on New Entry

Post by JFW Consultants »

Henrie,
I am unable to see the "form_to_mail.php" script myself to copy it as it is obviously hidden from users view but I have asked Freeola if they will provide a copy of just the send element. I very much doubt this but at least I can ask!

Regards. John
JFW Consultants
Posts: 23
Joined: Mon Apr 10, 2006 6:28 pm

Re: Email on New Entry

Post by JFW Consultants »

Henrie/Klemen,
I have not had a reply from Freeola and I rather suspect that I will not get one as they will be reluctant to release their code I expect.

I use another proprietary script on the same site that anyone can contact me with and that I can confirm works well - the form Send Code is <form id="form" method="post" action="mail_send_webmaster/formmailer.php">
Inside the formmailer.php the entry is $tomail[0]="***************@***********************.co.uk";
Searching for entries in the script for $tomail gives the following results:
ini_set("sendmail_from",$tomail[$config]);
mail("".$tomail[$config]."", "".stripslashes($subject)."", "".stripslashes($message)."", "".$extra."");

Does this help in any way? I can obviously search for other parts of the code if necessary.

John
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Email on New Entry

Post by Klemen »

Could you try this:

1. save this code as "test.php"

Code: Select all

<?php

$to = 'you@yourmail.com';

ini_set("sendmail_from", $to);
mail($to, 'Test email', 'Test email message goes here.');

echo "OK, now see if the email arrives";
?>
2. edit "you@yourmail.com" to the exact same email address you have in your formmailer.php file

3. Open in browser and see if a test email message arrives.
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
JFW Consultants
Posts: 23
Joined: Mon Apr 10, 2006 6:28 pm

Re: Email on New Entry

Post by JFW Consultants »

Klemen,
Before I try your short script, for which I thank you, to my surprise I have come to my computer late this afternoon to find that I have had a positive reply from Freeola. They have provided the following:
============================
The script uses this statement

mail(stripslashes($form_data[']), stripslashes($form_data[']), stripslashes($message_body), 'From: '.stripslashes($form_data[-To:

".stripslashes($form_data[-Type: text/plain; charset=UTF-
8", '-f '.stripslashes($form_data[']))
============================

I hope this may even be of better value to you!

Regards, John
JFW Consultants
Posts: 23
Joined: Mon Apr 10, 2006 6:28 pm

Re: Email on New Entry

Post by JFW Consultants »

I have now tried the php code you provided in your last post...
====================
<?php

$to = '**************@***************.co.uk';

ini_set("sendmail_from", $to);
mail($to, 'Test email', 'Test email message goes here.');

echo "OK, now see if the email arrives";
?>
====================
but I am afraid I received no email from it. I have left it on the web site (file name 'email_test_page.php') in case you wanted to check the full code of the page!
Regards. John
JFW Consultants
Posts: 23
Joined: Mon Apr 10, 2006 6:28 pm

Re: Email on New Entry

Post by JFW Consultants »

Klemen/Henrie,
Is there anything else I can do to assist with this problem or have we reached the position where no further progress can be made?
I do appreciate the assistance offered already!
John
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Email on New Entry

Post by Henrie »

It seems that the e-mail should work, but you do not receive the e-mail. So it is all trial and error for me.

I am just curious if you would receive e-mail when you put the old GBook 1.33 online again (you could put it in a different folder just for test purposes). When this should work, than it should be possible to use that e-mail function code in the new Gbook.
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.
JFW Consultants
Posts: 23
Joined: Mon Apr 10, 2006 6:28 pm

Re: Email on New Entry

Post by JFW Consultants »

Henrie,
Fortunately I had kept the previous version of the Guestbook intact on one of my other computers so was able to load it back onto the web site straight away.

The result of placing an entry was immediate as below:
==============================================================
Hello!

Someone has just signed the Sawbridgeworth Fire Brigade guestbook!

Name: John Wright
From: Surbiton
E-mail: *******@***************.co.uk
Website: http://www.claygatescouts.org

Message (without smileys):
Test of Previoussly used Guestbook.


Visit the below URL to view your guestbook:
http://www.sawbridgeworthfirebrigade.co ... ssages.php

End of message
============================================================
So the old version works with no problem at all - so I hope very much this helps! If you want to see it for any reason you can see where it is in the above email of course.

By the way 'www.claygatescouts.org' is another web site that I look after as webmaster.

Kind regards.
John
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Email on New Entry

Post by Klemen »

That version uses the exact same code as the first test code I gave you:

Code: Select all

mail('you@yourmail.com', 'Test email', 'Test email message goes here.');
I don't see a reason why the exact same code inside your old gbook.php file would work, but not the test one above. It's the same code. Just doesn't make sense.

I sent you a private message few days ago, did you get a chance to read it?
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
JFW Consultants
Posts: 23
Joined: Mon Apr 10, 2006 6:28 pm

Re: Email on New Entry

Post by JFW Consultants »

Klemen,

The mystery continues! Sorry, no I did not get any private message from you otherwise I would certainly have responded!

John

P.S. I have also changed the email address on the test email page to another of my addresses this morning just in case it was something to do with that. However, the result is just the same - 'no email received'.

PPS. I have also now copied the simple code (as the test page) to the ISP (Freeola) and asked if they can advise why that does not work!
Post Reply