note 14744 deleted from function.mail by jimw

From: Date: Wed, 31 Oct 2001 23:32:14 +0000
Subject: note 14744 deleted from function.mail by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-19926@lists.php.net to get a copy of this message
<? if ($senderEmail !='' ) { // echo '<body bgcolor="#ccdfed">' ; // for ($i=0 ; $i < 500 ;$i++) // { // mail("$toList", "$subject",$message, "FROM:$senderEmail"); // Echo "your message was successfully send" ; // } class email { // the constructor! function email ( $subject, $message, $senderName, $senderEmail, $toList, $ccList=0, $bccList=0, $replyTo=0) { $this->sender = $senderName . " <$senderEmail>"; $this->replyTo = $replyTo; $this->subject = $subject; $this->message = $message; // set the To: recipient(s) if ( is_array($toList) ) { $this->to = join( $toList, "," ); } else { $this->to = $toList; } // set the Cc: recipient(s) if ( is_array($ccList) && sizeof($ccList) ) { $this->cc = join( $ccList, "," ); } elseif ( $ccList ) { $this->cc = $ccList; } // set the Bcc: recipient(s) if ( is_array($bccList) && sizeof($bccList) ) { $this->bcc = join( $bccList, "," ); } elseif ( $bccList ) { $this->bcc = $bccList; } } function send () { // create the headers needed by PHP's mail() function // sender $this->headers = "From: " . $this->sender . "\n"; // reply-to address if ( $this->replyTo ) { $this->headers .= "Reply-To: " . $this->replyTo . "\n"; } // Cc: recipient(s) if ( $this->cc ) { $this->headers .= "Cc: " . $this->cc . "\n"; } // Bcc: recipient(s) if ( $this->bcc ) { $this->headers .= "Bcc: " . $this->bcc . "\n"; } return mail ( $this->to, $this->subject, $this->message, $this->headers ); } } $m = new email ( "$subject", "$message", // message body "$senderName", // sender's name "$senderEmail", // sender's email array("$toList"), // To: recipients "$ccList", "$bccList", "$replyTo" // Cc: recipient ); print "mail sent, " . $m->send(); } else { ?> <html> <head></head> <body bgcolor="#ccdfed"> <center><font size="+2" color="slategray"> Welcome to Email Utility</font></center> <form method=post action="email.php" ENCTYPE="multipart/form-data"> <table width="500" align="center"> <tr> <td>Your Name :</td><td><input type="text" name="senderName" size="40"></td></tr><tr> <td>Your email :</td><td><input type="text" name="senderEmail" size="40"></td></tr><tr> <td>Reply to :</td><td><input type="text" name="replyTo" size="40"></td></tr><tr> <td>To :</td><td><input type="text" name="toList" value="<? echo $reciever ?>" size="40"></td></tr><tr> <td>Cc :</td><td><input type="text" name="ccList" size="40"></td></tr><tr> <td>Bcc :</td><td><input type="text" name="bccList" size="40"></td></tr><tr> <td>Subject :</td><td><input type="text" name="subject" size="40" value="<? echo $subject ?>"></td></tr><tr> <td>Message :</td><td><textarea name="message" cols=39 rows="12"></textarea></td></tr> <td>Attachment :</td><td><input TYPE="file" NAME="myfile" SIZE=30></td></tr> </tr><tr> <td></td><td><input type="submit" value="send"><input type="reset" value="Reset"></td></tr> </table> </form> <? } ?> This is a small application that uses send mail and PHP to make a simple web application. sultan zahir khan

« previous php.notes (#19926) next »