Log in

View Full Version : php mailer script



peejeno
11-05-2006, 05:54 PM
hey guys, can some help me? i have this script called php mailer, and its great. heres what it looks like

php_mailer.php file:

<?php
function html_mail ($to, $subject, $html_message, $from_address, $from_display_name=''){
$email_from_addr = $from_address; // actual email address of the sender
$email_from_name = $from_display_name; // display name, if any, that the sender wishes to use
$email_subject = $subject; // The Subject of the email
$email_txt = $html_message; // Message that the email has in it
$email_to = $to; // Who the email is to
$headers = $email_from_name == '' ? "From: ".$email_from_addr : "From: ".$email_from_name." <".$email_from_addr.">";
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$email_message .= "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_txt .
"\n\n\n<span style=\"font-family: verdana, ariel, sans-serif; font-size: 11px\"><a href=\"http://4wordsystems.com\">Free code from 4word systems</a></span>";
// "<html><body><img src='" . $fileurl . "'><BR>" . $email_txt . "</body></html>\n\n";
$ok = @mail($email_to, $email_subject, $email_message, $headers);
if(! $ok) {
die("Sorry but the email could not be sent. Please go back and try again!");
}
}
?>


so thats the main file, and then there is a file called mailer_form.php


<?
include "html_mailer.php";
?>
<html>
<head>
<title>PHP Mailer</title>
</head>
<body><center>
<br><h2><b>PHP MAILER v1.0</b</h2><br>
<form action="html_mailer.php" method="POST" enctype="MULTIPART/FORM-DATA">
<table border=1 width="75%" cellpadding="1" cellspacing="0">
<tr><td align=right>Your Friend's E-mail Address</td><td><input name="to" size="45" value=""></td></tr>
<tr><td align=right>Your Name:</td><td><input name="from_name" size="45"></td></tr>
<tr><td align=right>Your E-mail Address:</td><td><input name="from" size="45"></td></tr>
</table><input type="submit" value="SEND MAIL"><input type="reset" value="CLEAR">
</form>
<br>
<hr><font size="1" color="#777777">
</body>
</html>

how can i get mailer_form.php where users can enter in there name (FROM), there e-mail address (FROM), there friends name (SEND TO), and there friends email address (SEND TO). so what ever html message is in the php_mailer.php will send to the friends inputed email address field,
can any one help?:confused:
thanks.

-peej

Onlineshop
11-08-2006, 12:49 PM
A very interesting site, I think. The Idea of Technometry was new for me but worth to be read and thought abot it (although I'm not a native english-speaker and have some difficulties whith this language)