Mail script not working

Guys, I have given up on the Perl script and switched to FormMail.php.
That seems to work, after a fashion, but I get this error: * Nothing was sent by a form. (No data was sent by POST or GET method.) There is nothing to process here.
I’m sure that either my html or the the script has errors, maybe someone can help?
html

<form method="POST" action="http://www.xxxxxxx.com/formmail.php">
<input type="hidden" name="env_report" value="www.xxxxxxx.com" />
<input type="hidden" name="recipient" value="xx@xxxxxx.com">
<table border="0" cellpadding="0" cellspacing="0" width="400" align="center"><tr>
<td width="400" align="right" valign="middle" class="c13">Your Name:&nbsp;&nbsp;<input type="text" size="40" maxlength="60" name="Name">&nbsp;&nbsp;&nbsp;</td>
</tr><tr>
<td width="400" align="right" valign="middle" class="c13">Phone:&nbsp;&nbsp;<input type="text" size="40" maxlength="60" name="Phone">&nbsp;&nbsp;&nbsp;</td>
</tr><tr>
<td width="400" align="right" valign="middle" class="c13">E-mail:&nbsp;&nbsp;<input type="text" size="40" maxlength="60" name="E-mail">&nbsp;&nbsp;&nbsp;</td>
</tr><tr>
<td class="c13" align="center" valign="middle"><br><b>Enter any additional information you wish<br> in the space provided below:</b>
<br><textarea name="Additional Information" rows="5" cols="50"></textarea>
<br>
<input type="SUBMIT" value="Send to Brigitte">&nbsp;&nbsp;&nbsp;<input type="RESET" value="Start Over"></td></tr></table>
</form>

php

// To change the address the e-mail comes from use define('FROM', 'Example Name <email@example.com>');
define('FROM', null);

$referers = array('http://www.xxxxxx.com', 'xxxxxx.com');

// $recipient_array format is $recipient_array = array('sometext'=>'email@example.com','asdf'=>'email2@example.com');
$recipient_array = array();

$valid_env = array('www.xxxxxxxx.com');

I feel like we’re missing half the script… where do you actually invoke the mailing in the PHP? Is there an opening <form> tag somewhere above that HTML?

It appears that part of the script got lost during the transition from Perl to PHP.
Here it is:

<form method="POST" action="http://www.bmrealty.com/formmail.php">
<input type="hidden" name="env_report" value="www.bmrealty.com" />
<input type="hidden" name="recipient" value="bm@bmrealty.com">

@m_hutley is referring to the PHP code. There should be a portion where it actually sends the email to the recipient. We’re looking to see that piece of the code.

well i was looking for both. So… yes, there is a form tag, it’s a standard POST to a php script. This is important information to check off the checklist of ‘things that could go wrong’ (post vs get, wrong script name, etc).

But yes, we will need the rest of the PHP as well. Or at least the relevant bits about mailing.

Ok, you want me to post the entire PHP script?
The portion that needs editing is posted at #1.

Do you mean this FormMail script?

If it is the above, it’s an lot of script to post in the forum, but can be downloaded from the site.
It is one I’ve used in the past, but it’s been a long time.

I have edited the code formatting in the original post, so more code is visible now.

It’s this script:

<?PHP
define('VERSION', 'Classic v1.07.3');
define('MANUAL', 'http://www.boaddrink.com/projects/phpformmail/readme.php');
define('CHECK_REFERER', true);

That looks like the script described here, but the the code on Github isn’t there.

Well the code is there, its just not in the Release that was linked to.

If you got the error * Nothing was sent by a form. (No data was sent by POST or GET method.) There is nothing to process here.
from that script, it bounced from the decode_vars function with no input. (Incidentally, i dont understand the point of the if on line 180 of the script, but… thats beyond the scope of this thread)

Is something in Javascript intercepting the form data? What you’ve got there doesnt… look like it would generate the error…

Yes, that’s the exact error message I get: Nothing was sent by a form. (No data was sent by POST or GET method.) There is nothing to process here.
There’s no Javascript involved.

Something’s fishy.

Try putting this line after $errors = $fieldname_lookup = array();

$errors[] = print_r($_REQUEST,true);

Tried that, got the same result.
I noticed one other thing: when I enter text in the fields a notice that this form is not secure pops up. Maybe that prevents from sending the text?

Use your browser Developer Tools, so you can check of any errors and what is actually being send (or not) to the server

So you added that line, which should have put an additional error in the set, and you got… the exact same result? Not something extra before the original error?

Are you sure you saved the modification?

Yes, I got the exact same result and yes, I did save the mod.
Sorry to be a nuisance.

Not a nuisance, just odd. That should have put at the very least something in the error queue that showed an empty array.

If you’re comfortable with the document inspector (Developer Tools, usually opens if you hit F12 in most browsers), as Zensei says, check for errors there, and if you have the Network tab of the Developer Tools open when you send the form, you should see a request go out to formmail.php; if you click on that request, and then on the “Payload” tab, it should show you what it sent the server…

1 Like

I’ve taken a screen shot.

Update: I have played around with the form and now, when I hit “Submit” I’m getting the php script to open in the browser. Does that help in any way?