Usefull Scripts
Monday, October 26, 2009
Sending email with PHP
Copy and paste this code where u want..
<br><!-- this script got from <br>http://usefull-script.blogspot.com/Coded by: Ratnakar Mishra --><br><br><br><?php<br>// See comments below (right above the form).<br><br> if ($mode == "submit") {<br> if ($enable_html != "on") {<br>/*<br> The user does not want to send the e-mail in HTML format, so we must get<br> rid of the HTML in the message.<br>*/<br> $mail_body = htmlspecialchars ($mail_body);<br> }<br><br>// Now we set the headers for our e-mail message.<br><br> $headers .= "MIME-Version: 1.0 \n";<br> $headers .= "Content-type: text/html; charset=iso-8859-1 \n";<br> $headers .= "from:$mail_from\r\nCc:$mail_cc\r\nBcc:$mail_bcc";<br><br>/*<br> Now it's time to send the message, we'll use the mail () function.<br> The function will return TRUE on success, FALSE on failure.<br> We can use that to make sure the e-mail was sent without<br> any problems.<br> The "@" in front of the function is optional. In PHP, whenever<br> there is an @ in front of ANY function, the script will not show<br> any errors. As we will let the user know if anything goes wrong<br> ourselves, we don't need PHP to give the errors for us and we can<br> show the error however we want (not with Warning: ... on line ...).<br>*/<br><br> if (@mail ($mail_to, $mail_subject, $mail_body, $headers)) {<br> print ("<h1><font color=\"#004000\">The e-mail was sent successfully!</font></h1>");<br> } else {<br> print ("<h1><font color=\"#880000\">An error occurred while sending the e-mail!</font></h1>");<br> }<br><br>// We don't need to show the form again.<br><br> exit;<br> }<br>?><br><br><html><br><br><head><br><title>Send e-mail</title><br><script language="javascript"><br> function DoSubmit ()<br> {<br>/*<br> This javascript will check if the important fields have been filled in.<br> The control is pretty basic (if the user types " " it will see it as full,<br> but it is enough to alert a person who forgot to fill out a form, without<br> him / her having to wait until the form refreshes (good for slow modems).<br><br> The return ""; command will exit the function, so that the form is only<br> submitted when it is valid.<br>*/<br><br> if (document.form.mail_from.value == "") {<br> alert ("You forgot to enter the 'from' field.");<br> document.form.mail_from.focus ();<br> return "";<br> }<br><br> if (document.form.mail_to.value == "") {<br> alert ("You forgot to enter the 'to' field.");<br> document.form.mail_to.focus ();<br> return "";<br> }<br><br> if (document.form.mail_subject.value == "") {<br> alert ("You forgot to enter the 'subject' field.");<br> document.form.mail_subject.focus ();<br> return "";<br> }<br><br> if (document.form.mail_body.value == "") {<br> alert ("You forgot to enter the 'Message' field.");<br> document.form.mail_body.focus ();<br> return "";<br> }<br><br> document.form.submit ();<br> }<br></script><br></head><br><br><body><br><!--<br> By setting the form's action to $PHP_SELF, this code will work even<br> when you change the name from email.php into whatever you want (.php).<br><br> The included (hidden) field, mode, will be used to see if the user has<br> submitted the form or if the page is loading for the first time. If the<br> user has submitted the page, the variable $mode will have the string<br> "submit" as its value, otherwise the variable will be empty.<br>--><br><form action="<?php print ($PHP_SELF); ?>" method="post" name="form"><br> <table><br> <tr><br> <td>From:</td><br> <td><input type="text" name="mail_from" size="40"></td><br> </tr><br> <tr><br> <td>To:</td><br> <td><input type="text" name="mail_to" size="40"></td><br> </tr><br> <tr><br> <td>Cc:</td><br> <td><input type="text" name="mail_cc" size="40"></td><br> </tr><br> <tr><br> <td>Bcc:</td><br> <td><input type="text" name="mail_bcc" size="40"></td><br> </tr><br> <tr><br> <td>Subject:</td><br> <td><input type="text" name="mail_subject" size="40"></td><br> </tr><br> <tr><br> <td valign="top">Message:</td><br> <td><textarea name="mail_body" cols="40" rows="10">
JavaScript Free Code
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Best script category
Alert Message
(2)
Background Effect
(5)
Buttons
(11)
Calculators
(6)
Forms
(3)
Fun Script
(1)
Java script
(3)
Miscellaneous
(2)
PHP Script
(10)
Search Box
(2)
Blog Archive
▼
2009
(57)
►
November
(7)
▼
October
(50)
Try this one or "Never say No"
Make a search engine for your own site
Make a Stopwatch with the help of Java Script
Email validation script in Php
Automatic Download script in Php
Simple email button to send E-mail Someone
Form design Agree Before Entry
Make a simple Downloaded file counter in Php
Make a simple web counter with the help of Php script
Simple Zip extractor script in Php
Easy File Upload Program in Php
Sending email with PHP
make a Atmosphere calculator
make a Age calculators
Make a Advance calculators
Make a Adjusted Cost Base calculators
Make a Ad calculators
Make a five function calculators
Background effect in webpage -INSTALL CELL BG CHANGER
Background effect in webpage ( Blink the backgroun...
Background effect in webpage ( Ball drop effect)
Background effect in webpage (astronaut effect)
Background effect in webpage (alien-spacecraft eff...
Add Windows postion relared buttons
Inser some funny message with push button
Insert image button in your blogs
Headliner (Differnt effect of button)
Install email button in your web page
Clicks to submit button
Check box script for your web site
Add Button url link in your web site
APOLOGIZE E-MAIL script in web page
Add alert button in your site
Moving Text status
Text alert for enter and exit
Close the browser with a button
MSN Search in your web page
Google search in web page
Rain effects on your text
Fall Leaves in your web page
Snow fall in your web page
Magical title for weblogs or any pages on the int...
Star Moving in your web site back ground
Mouse movement decoration with heart symbole
Add fireworks on your website
Search box for website
Decorate your scrollbar (Color full scroll bar )
Make a home page of your web site
No right click of mouse
You can bring a message box or a alert a window wh...
Free Search Engine Submission
Followers
About Me
Ratnakar Mishra
View my complete profile
Number of visitors
No comments:
Post a Comment