Form to Mail Script Configuration

Get the script

Before uploading the script to your server you need to change some fields in the "inc/econf.php" file. The first field is $ref. This is an array of all of the valid server addresses that will be permitted to access this script. You will probably have two entries that you want to include here. If your web address is then you will want to list and This information serves two purposes. First is that if anyone else tries to link to your script from a server other than one you have listed then all they will get when anyone tries to use the script is a page telling the visitor that the script does not support the web host - at least for anyone who hasn't got the referrer page option disabled it will. Secondly, the first address in the list (which should always be the one without the www on the front) will be used to create the email address to which error messages should be returned. For our example web site the mail would be returned to

The next field that needs to be updated (for the advanced version) is $serial which needs to contain the serial number issued to you when you purchased the script.

The other fields that need to be configured are $do, $ro, $destemail, and (if $do = -1) $val_email. You need to set $destemail to be the email address that you want to use as the default destination for emails generated by the script. If the $do field is set to 0 then the script will only send emails to this address, if $do is set to 1, 2, or 3 then the destination (to) address can be overridden by posting a field named destemail from a form calling the script. If set to 2 then the to, cc, and bcc email addresses will be verified and rejected if the domain is not found, the domain is not running a mailserver, or the mailserver reports that no such mailbox exists. If set to 3 then the to, cc, and bcc email addresses will also be rejected if the mailserver refuses to report whether the mailbox does or doesn't exist. If you set $do to -1 then you can supply an array of valid destination email addresses in $val_email and only when the destemail matches an entry in the array can the email be sent. You can restrict the destination addresses to an entire domain by just specifying the portion of the address in the $val_email array. $ro works similarly to $do for the sender's replyemail address if set to 2 or 3. Note that mailbox verification ($do = 2 or 3, $ro = 2 or 3) is only performed if you are running version 3+ of the advanced script. Those values are treated the same as 1 in the free script and in earlier versions of the advanced script.

One other field you may want to update if you are using the advanced script and your forms allow a free format message is to update the $mesmax to limit the number of text links that can be included (and thus reduce spam).

Finally if your web server is using qmail then it expects \n header separators instead of the standard \r\n separators. To fix this set $f_q = 1.

Once you have set these values appropriately, you can upload the script to your web host. You will also need to upload the files within the "inc" folder to an "inc" directory on your server.

Get the script


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow