HOWTO: A Contact form WITHOUT sendmail enabled...
Popularity Report
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
Bookmark History
Saved by 1 people (0 private), first by anonymouse user on 2007-08-27
- Lbibeachbum297 on 2007-08-27 - Tags stuff , web
Public Sticky notes
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://uploadingit.com/files/181711_6q627/phpmailer.zip
Unzip the file onto your desktop preserving the folder structure and you will end up with a folder called:
"phpmailer"
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 - contactform.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 text
Open the contactform.php in your favourite text editor (preferrable crimson editor or notepad2)
On line 12 you will see the following:
Modifying this part:
Y = NO http web links in message
N = Yes.. http allowed
Modify as necessary
Changing the E-mail Message
Scroll down to line 61 and you can modify the body of the e-mail message as you see fit.
Changing the form text
Scroll 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 modifications
Configuration of the sendit.php file
Open 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 may change the folder name from "phpmailer" 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 the file into a folder on your website - example is; "phpmailer"
To call the web form script just point your browser to:
http://mysite.110mb.com/phpmailer/contactform.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:
In the body section, where you want a contact form link, use:
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.
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://uploadingit.com/files/181711_6q627/phpmailer.zip
Unzip the file onto your desktop preserving the folder structure and you will end up with a folder called:
"phpmailer"
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 - contactform.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 text
Open the contactform.php in your favourite text editor (preferrable crimson editor or notepad2)
On line 12 you will see the following:
Quote
/******** START OF CONFIG SECTION *******/
$sendto = "receivers e-mail address goes here";
$subject = "Website Contact Enquiry";
$sendto = "receivers e-mail address goes here";
$subject = "Website Contact Enquiry";
Modifying this part:
Quote
// Select if you want to check form for standard spam text
$SpamCheck = "Y"; // Y or N
$SpamCheck = "Y"; // Y or N
Y = NO http web links in message
N = Yes.. http allowed
Modify as necessary
Changing the E-mail Message
Scroll down to line 61 and you can modify the body of the e-mail message as you see fit.
Changing the form text
Scroll 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 modifications
Configuration of the sendit.php file
Open 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 may change the folder name from "phpmailer" 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 the file into a folder on your website - example is; "phpmailer"
To call the web form script just point your browser to:
http://mysite.110mb.com/phpmailer/contactform.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:
Quote
<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>
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:
Quote
<a href="http://www.110mb.com/javascript:MailPopUp('../phpmailer/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.
Highlighted by lbibeachbum297


Public Comment