PHPBuilder - send mails from forms in HTML format



RSS Twitter
Snippets Networking

send mails from forms in HTML format

by: gordon thomas
|
October 24, 2001

Version: 1.1

Type: Full Script

Category: Networking

License: GNU General Public License

Description: This script can be used to send mails from text entered in a form.. It is sent in HTML format.



<?php
/*
        DESCRIPTION   	  :       To Send Emails from Forms in HTML format using php
        
        AUTHOR     	                :       Gordon Thomas <gordon9728@yahoo.com>

        COMMENTS      	  :       1. Change "your_name" to sender's name
                                	          2. Change "your_login" to sender's login
                               	          3. Change "your_domain_name" to sender's domain name 
                                	          4. Change "recipient_login" to recipient's login
                        	                        5. Change "recipient_domain_name" to recipient's domain name 

*/

$todaysDate = date ("d.m.y", time ());
$TO = "recipient_login@recipient_domain_name";
$CC = "recipient_login@recipient_domain_name";
$MP = "/usr/sbin/sendmail -t";
if ($formFill){
        $fd = popen($MP,"w"); 
        fputs($fd, "To: $TO\n"); 
        fputs($fd, "Cc: $CC\n"); 
        fputs($fd, "From: your_name <your_login@your_domain_name>\n"); 
        fputs($fd, "Subject: subject \n"); 
        fputs($fd, "X-Mailer: PHP\n");
        fputs($fd, "Content-Type: text/html; charset=us-ascii\n");
        fputs($fd, "Content-Transfer-Encoding: 7bit\n");
        fputs($fd, "<body bgcolor=\"#9fb6cd\">\n");
        fputs($fd, "<b><u>Text Area 1</u>:</b>$work\n"); 
        fputs($fd, "<br>\n"); 
        fputs($fd, "<br>\n"); 
        fputs($fd, "<b><u>Text Area 2</u>:</b>$deadline\n");
        fputs($fd, "<br>\n"); 
        fputs($fd, "<br>\n"); 
        fputs($fd, "<b><u>Text Area 3</u>:</b>$learnt\n");
        fputs($fd, "<br>\n"); 
        fputs($fd, "<br><hr><br>\n"); 
        fputs($fd, "Regards,<br>your_name<br>\n");
        fputs($fd, "</body>\n");
        pclose($fd); 
        exit;
}else{
        echo "<html>";
        echo "<body bgcolor=\"#000000\">";
        echo "<font color=\"skyblue\"><b><u>DATE : $todaysDate</u></b></font><br><br><br>";
        echo "<form method=\"post\" action=\"this_files_name.php\">";
        echo "<table width=\"90%\" align=center cellspacing=1 cellpadding=0 border=0 bgcolor=\"#415f6c\">";
        echo "<tr>";
        echo "<td align=center><font color=\"#ffffff\"><b>Text Area 1</b></font></td>";
        echo "<td align=center><textarea rows=5 cols=40 name=\"work\">&lt;br&gt;</textarea></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td align=center><font color=\"#ffffff\"><b>Text Area 1</b></font></td>";
        echo "<td align=center><textarea rows=5 cols=40 name=\"deadline\">&lt;br&gt;</textarea></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td align=center><font color=\"#ffffff\"><b>Text Area 1</b></font></td>";
        echo "<td align=center><textarea rows=5 cols=40 name=\"learnt\">&lt;br&gt;</textarea></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td align=center>";
        echo "<input type=\"hidden\" name=\"formFill\" value=\"formmail\">";
        echo "<input type=\"submit\" value=\"Send Mail\">"; 
        echo "</td>";
        echo "<td align=\"right\" bgcolor=\"#000000\">";
        echo "<font color=\"skyblue\"><b>";
        echo "&copy; Gordon Thomas";
        echo "<b></font>";
        echo "</td>";
        echo "</tr>";
        echo "</table>";
        echo "</form>";
        echo "</body>";
        echo "</html>";
}
?>

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
gordon thomas

Comment:



Comment:

(Maximum characters: 1200). You have characters left.