Using a contact form without sendmail being enabled.Requirements: Fsockopen() enabled and a little php/text editing knowledge (very little!)
Skill level: Easy!
A googlemail or yahoo.au.com account is required.
Download the following zip file:http://teamyankee.110mb.com/tut-pics/SMTP-contactform.zipAlso the dual e-mail version...
http://teamyankee.110mb.com/tut-pics/smtp-contact-dual-mail.zipMore files here: http://drive.heartinternet.co.uk/56951687The one you want is the "SMTP-CONTACT-FORM" or the dual one for sending to 2 e-mails at the same time.
Unzip the file contents into a new folder on your desktop.
In here you will find various files for the script to work.
do not modify - class.smtp.php - this does the actual work.
do not modify - class.phpmailer.php - so does this one...
modify - contact.php - the actual contact form script.
modify - sendit.php - contains the smtp server name and user/password and actually sends the mail using phpmailer.
Modifying the contact form textOpen the contactform.php in your favourite text editor (preferrable crimson editor or notepad2)
On line 12 you will see the following: (you can now also enable "dual" mail sending... one message to 2 mails)
/******** START OF CONFIG SECTION *******/
$sendto = "receivers e-mail address goes here";
//$sendto2 = "second receivers e-mail goes here"; // Just remove the first "//" to enable. Also see the sendit.php file.
$subject = "Website Contact Enquiry";
Modifying this part:
// Select if you want to check form for standard spam text
$SpamCheck = "Y"; // Y or N
Y = NO http web links in message
N = Yes.. http allowed
Modify as necessary
Changing the E-mail MessageScroll down to line 61 and you can modify the body of the e-mail message as you see fit.
Changing the form textScroll to line 110 - this contains the text of the form data entry page. Edit as necessary.
You can edit the form text and layout using your "favourite" graphical web editor - like MS Expression web or NVU etc.
- this has been tested as working.
I've not tested it with MS frontpage so I don't know how it handles PHP files. It probably mangles them.
As this web contact form started out as a sendmail form it has redundant code which I've left in to enable a simple return to sendmail operation if needed.
See line 94 to line 98 for the phpmailer modificationsConfiguration of the sendit.php fileOpen the sendit.php file in a text editor and enter your details for googlemail in the correct places.
This will also work with yahoo.co.au mail - just ammend as needed.
You can also remove the "//" comments to enabledual mail support.
You may change the folder name to anything you want..
Keep all the files together in the same folder or it won't work.Now it's ready to go...
Use your favourite uploading method and upload all the files into a folder on your website - example is; "form"
To call the web form script just point your browser to:
http://mysite.110mb.com/form/contact.php and fill in the form.
For a nice and tidy popup window as a contact form use the following code:
In your
page header use:
<script language="JavaScript">
function MailPopUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=550,height=400,left = 340,top = 212');");
}
</script>
In the body section, where you want a contact form link, use:
<a href="javascript:MailPopUp('../form/contactform.php')"><em>CONTACT FORM</em></a>
Obviously the path should reflect the location of the contactform.php file.
When you submit the form there is a close window button to tidy up the popup window.
It also works fine with popup blockers too.