SMTP mail form with PEAR and WAMPServer?
- mindfullsilence
- Proficient


- Joined: Aug 04, 2008
- Posts: 436
- Status: Offline
honestly, I've been working on this for days and have gotten nowhere. No idea what to write for code, no idea how to get it to send, no idea where I left my brain when it leaked out of my head.
I'd post some code for you guys to look at, but I don't have any, like I said, none of it is working, nor is it even close.
I need the form on this site: http://173.11.86.101/voltec/ to post to a php file that works with PEARs mail addon.
I've looked at about 20 different sites, read through the tutorials bogey posted here, as well as 10 - 15 tuts elsewhere. Any help guys?
I'd post some code for you guys to look at, but I don't have any, like I said, none of it is working, nor is it even close.
I need the form on this site: http://173.11.86.101/voltec/ to post to a php file that works with PEARs mail addon.
I've looked at about 20 different sites, read through the tutorials bogey posted here, as well as 10 - 15 tuts elsewhere. Any help guys?
Use your words like arrows to shoot toward your goal.
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
June 24th, 2009, 9:44 pm
Show me the PEAR mail addon... can you also explain the problem a little more? What exactly are you trying to do... you want those things in the form sent to you VIA email?
I can send you the SMTP Class that I got and modified a little bit... it works perfectly. (I use it to send account verification, contact me, or user to user email sending and my other emailing needs).
It looks like the PEAR's mail addon is missing at least one dependency. (Mail.php asked for in sendemail.php).
I can send you the SMTP Class that I got and modified a little bit... it works perfectly. (I use it to send account verification, contact me, or user to user email sending and my other emailing needs).
It looks like the PEAR's mail addon is missing at least one dependency. (Mail.php asked for in sendemail.php).
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
- mindfullsilence
- Proficient


- Joined: Aug 04, 2008
- Posts: 436
- Status: Offline
The SMTP class that I use is...
The $smtpServer is the SMTP server that you are using. GMAIL does this, or you can use yours if you have one.
The $port is the port number for the SMTP server.
The $username is the username used to log-in to SMTP server.
The $password is the password used with the username to log-in to SMTP server.
The $username_email is your main email where the mails would be sent to.
The $localdomain is your domain.
And to use it with your information...
I hope that made sense. And I hope that helps
About the PEAR thing. Make sure that Mail.php is in the correct directory and that the include code has the correct address to Mail.php
<?php
// Mail.php
class mail
{
private $smtpServer = 'smtp.site.com';
private $port = '25';
private $timeout = 30;
private $username = 'smtp_user';
private $password = 'smtp_pass';
private $username_email = 'admin@site.com';
private $newline = "\r\n";
private $localdomain = 'site.com';
private $charset = 'windows-1251';
private $contentTransferEncoding = false;
// Do not change anything below
private $smtpConnect = false;
private $to = false;
private $subject = false;
private $message = false;
private $headers = false;
private $logArray = array(); // Array response message for debug
private $Error = '';
public function __construct($to, $subject, $message, $to2 = false) {
$this->to = (($to2 !== false)? $this->username_email : $to);
$this->subject = &$subject;
$this->message = &$message;
// Connect to server
if(!$this->Connect2Server()) {
// Display error message
echo '<pre>'.trim($this->Error).'</pre>'.$this->newline.'<!-- '.$this->newline;
print_r($this->logArray);
echo $this->newline.'-->'.$this->newline;
return false;
}
return true;
}
private function Connect2Server() {
$from = (($to2 == false)? $this->username_email : $to);
// Connect to server
$this->smtpConnect = fsockopen($this->smtpServer,$this->port,$errno,$error,$this->timeout);
$this->logArray['CONNECT_RESPONSE'] = $this->readResponse();
if (!is_resource($this->smtpConnect)) {
return false;
}
$this->logArray['connection'] = "Connection accepted: {$smtpResponse}";
// Hi, server!
$this->sendCommand("HELO {$this->localdomain}");
$this->logArray['HELO'] = $this->readResponse();
// Let's know each other
$this->sendCommand('AUTH LOGIN');
$this->logArray['AUTH_REQUEST'] = $this->readResponse();
// My name...
$this->sendCommand(base64_encode($this->username));
$this->logArray['REQUEST_USER'] = $this->readResponse();
// My password..
$this->sendCommand(base64_encode($this->password));
$this->logArray['REQUEST_PASSWD'] = $this->readResponse();
// If error in response auth...
if (substr($this->logArray['REQUEST_PASSWD'],0,3)!='235') {
$this->Error .= 'Authorization error! '.$this->logArray['REQUEST_PASSWD'].$this->newline;
return false;
}
// "From" mail...
$this->sendCommand("MAIL FROM: {$from}");
$this->logArray['MAIL_FROM_RESPONSE'] = $this->readResponse();
if (substr($this->logArray['MAIL_FROM_RESPONSE'],0,3)!='250') {
$this->Error .= 'Mistake in sender\'s address! '.$this->logArray['MAIL_FROM_RESPONSE'].$this->newline;
return false;
}
// "To" address
$this->sendCommand("RCPT TO: {$this->to}");
$this->logArray['RCPT_TO_RESPONCE'] = $this->readResponse();
if(substr($this->logArray['RCPT_TO_RESPONCE'],0,3) != '250')
{
$this->Error .= 'Mistake in reciepent address! '.$this->logArray['RCPT_TO_RESPONCE'].$this->newline;
}
// Send data to server
$this->sendCommand('DATA');
$this->logArray['DATA_RESPONSE'] = $this->readResponse();
// Send mail message
if (!$this->sendMail()) return false;
// Good bye server! =)
$this->sendCommand('QUIT');
$this->logArray['QUIT_RESPONSE'] = $this->readResponse();
// Close smtp connect
fclose($this->smtpConnect);
return true;
}
// Function send mail
private function sendMail() {
$this->sendHeaders();
$this->sendCommand($this->message);
$this->sendCommand('.');
$this->logArray['SEND_DATA_RESPONSE'] = $this->readResponse();
if(substr($this->logArray['SEND_DATA_RESPONSE'],0,3)!='250') {
$this->Error .= 'Mistake in sending data! '.$this->logArray['SEND_DATA_RESPONSE'].$this->newline;
return false;
}
return true;
}
// Function read response
private function readResponse() {
$data="";
while($str = fgets($this->smtpConnect,4096))
{
$data .= $str;
if(substr($str,3,1) == " ") { break; }
}
return $data;
}
// function send command to server
private function sendCommand($string) {
fputs($this->smtpConnect,$string.$this->newline);
return ;
}
// function send headers
private function sendHeaders() {
$from = (($to2 == false)? $this->username_email : $to);
$this->sendCommand("Date: ".date("D, j M Y G:i:s")." +0700");
$this->sendCommand("From: <{$from}>");
$this->sendCommand("Reply-To: <{$from}>");
$this->sendCommand("To: <{$this->to}>");
$this->sendCommand("Subject: {$this->subject}");
$this->sendCommand("MIME-Version: 1.0");
$this->sendCommand("Content-Type: text/html; charset={$this->charset}");
if ($this->contentTransferEncoding) $this->sendCommand("Content-Transfer-Encoding: {$this->contentTransferEncoding}");
return ;
}
public function __destruct() {
if (is_resource($this->smtpConnect)) fclose($this->smtpConnect);
}
}
?>
// Mail.php
class mail
{
private $smtpServer = 'smtp.site.com';
private $port = '25';
private $timeout = 30;
private $username = 'smtp_user';
private $password = 'smtp_pass';
private $username_email = 'admin@site.com';
private $newline = "\r\n";
private $localdomain = 'site.com';
private $charset = 'windows-1251';
private $contentTransferEncoding = false;
// Do not change anything below
private $smtpConnect = false;
private $to = false;
private $subject = false;
private $message = false;
private $headers = false;
private $logArray = array(); // Array response message for debug
private $Error = '';
public function __construct($to, $subject, $message, $to2 = false) {
$this->to = (($to2 !== false)? $this->username_email : $to);
$this->subject = &$subject;
$this->message = &$message;
// Connect to server
if(!$this->Connect2Server()) {
// Display error message
echo '<pre>'.trim($this->Error).'</pre>'.$this->newline.'<!-- '.$this->newline;
print_r($this->logArray);
echo $this->newline.'-->'.$this->newline;
return false;
}
return true;
}
private function Connect2Server() {
$from = (($to2 == false)? $this->username_email : $to);
// Connect to server
$this->smtpConnect = fsockopen($this->smtpServer,$this->port,$errno,$error,$this->timeout);
$this->logArray['CONNECT_RESPONSE'] = $this->readResponse();
if (!is_resource($this->smtpConnect)) {
return false;
}
$this->logArray['connection'] = "Connection accepted: {$smtpResponse}";
// Hi, server!
$this->sendCommand("HELO {$this->localdomain}");
$this->logArray['HELO'] = $this->readResponse();
// Let's know each other
$this->sendCommand('AUTH LOGIN');
$this->logArray['AUTH_REQUEST'] = $this->readResponse();
// My name...
$this->sendCommand(base64_encode($this->username));
$this->logArray['REQUEST_USER'] = $this->readResponse();
// My password..
$this->sendCommand(base64_encode($this->password));
$this->logArray['REQUEST_PASSWD'] = $this->readResponse();
// If error in response auth...
if (substr($this->logArray['REQUEST_PASSWD'],0,3)!='235') {
$this->Error .= 'Authorization error! '.$this->logArray['REQUEST_PASSWD'].$this->newline;
return false;
}
// "From" mail...
$this->sendCommand("MAIL FROM: {$from}");
$this->logArray['MAIL_FROM_RESPONSE'] = $this->readResponse();
if (substr($this->logArray['MAIL_FROM_RESPONSE'],0,3)!='250') {
$this->Error .= 'Mistake in sender\'s address! '.$this->logArray['MAIL_FROM_RESPONSE'].$this->newline;
return false;
}
// "To" address
$this->sendCommand("RCPT TO: {$this->to}");
$this->logArray['RCPT_TO_RESPONCE'] = $this->readResponse();
if(substr($this->logArray['RCPT_TO_RESPONCE'],0,3) != '250')
{
$this->Error .= 'Mistake in reciepent address! '.$this->logArray['RCPT_TO_RESPONCE'].$this->newline;
}
// Send data to server
$this->sendCommand('DATA');
$this->logArray['DATA_RESPONSE'] = $this->readResponse();
// Send mail message
if (!$this->sendMail()) return false;
// Good bye server! =)
$this->sendCommand('QUIT');
$this->logArray['QUIT_RESPONSE'] = $this->readResponse();
// Close smtp connect
fclose($this->smtpConnect);
return true;
}
// Function send mail
private function sendMail() {
$this->sendHeaders();
$this->sendCommand($this->message);
$this->sendCommand('.');
$this->logArray['SEND_DATA_RESPONSE'] = $this->readResponse();
if(substr($this->logArray['SEND_DATA_RESPONSE'],0,3)!='250') {
$this->Error .= 'Mistake in sending data! '.$this->logArray['SEND_DATA_RESPONSE'].$this->newline;
return false;
}
return true;
}
// Function read response
private function readResponse() {
$data="";
while($str = fgets($this->smtpConnect,4096))
{
$data .= $str;
if(substr($str,3,1) == " ") { break; }
}
return $data;
}
// function send command to server
private function sendCommand($string) {
fputs($this->smtpConnect,$string.$this->newline);
return ;
}
// function send headers
private function sendHeaders() {
$from = (($to2 == false)? $this->username_email : $to);
$this->sendCommand("Date: ".date("D, j M Y G:i:s")." +0700");
$this->sendCommand("From: <{$from}>");
$this->sendCommand("Reply-To: <{$from}>");
$this->sendCommand("To: <{$this->to}>");
$this->sendCommand("Subject: {$this->subject}");
$this->sendCommand("MIME-Version: 1.0");
$this->sendCommand("Content-Type: text/html; charset={$this->charset}");
if ($this->contentTransferEncoding) $this->sendCommand("Content-Transfer-Encoding: {$this->contentTransferEncoding}");
return ;
}
public function __destruct() {
if (is_resource($this->smtpConnect)) fclose($this->smtpConnect);
}
}
?>
- <?php
- // Mail.php
- class mail
- {
- private $smtpServer = 'smtp.site.com';
- private $port = '25';
- private $timeout = 30;
- private $username = 'smtp_user';
- private $password = 'smtp_pass';
- private $username_email = 'admin@site.com';
- private $newline = "\r\n";
- private $localdomain = 'site.com';
- private $charset = 'windows-1251';
- private $contentTransferEncoding = false;
- // Do not change anything below
- private $smtpConnect = false;
- private $to = false;
- private $subject = false;
- private $message = false;
- private $headers = false;
- private $logArray = array(); // Array response message for debug
- private $Error = '';
- public function __construct($to, $subject, $message, $to2 = false) {
- $this->to = (($to2 !== false)? $this->username_email : $to);
- $this->subject = &$subject;
- $this->message = &$message;
- // Connect to server
- if(!$this->Connect2Server()) {
- // Display error message
- echo '<pre>'.trim($this->Error).'</pre>'.$this->newline.'<!-- '.$this->newline;
- print_r($this->logArray);
- echo $this->newline.'-->'.$this->newline;
- return false;
- }
- return true;
- }
- private function Connect2Server() {
- $from = (($to2 == false)? $this->username_email : $to);
- // Connect to server
- $this->smtpConnect = fsockopen($this->smtpServer,$this->port,$errno,$error,$this->timeout);
- $this->logArray['CONNECT_RESPONSE'] = $this->readResponse();
- if (!is_resource($this->smtpConnect)) {
- return false;
- }
- $this->logArray['connection'] = "Connection accepted: {$smtpResponse}";
- // Hi, server!
- $this->sendCommand("HELO {$this->localdomain}");
- $this->logArray['HELO'] = $this->readResponse();
- // Let's know each other
- $this->sendCommand('AUTH LOGIN');
- $this->logArray['AUTH_REQUEST'] = $this->readResponse();
- // My name...
- $this->sendCommand(base64_encode($this->username));
- $this->logArray['REQUEST_USER'] = $this->readResponse();
- // My password..
- $this->sendCommand(base64_encode($this->password));
- $this->logArray['REQUEST_PASSWD'] = $this->readResponse();
- // If error in response auth...
- if (substr($this->logArray['REQUEST_PASSWD'],0,3)!='235') {
- $this->Error .= 'Authorization error! '.$this->logArray['REQUEST_PASSWD'].$this->newline;
- return false;
- }
- // "From" mail...
- $this->sendCommand("MAIL FROM: {$from}");
- $this->logArray['MAIL_FROM_RESPONSE'] = $this->readResponse();
- if (substr($this->logArray['MAIL_FROM_RESPONSE'],0,3)!='250') {
- $this->Error .= 'Mistake in sender\'s address! '.$this->logArray['MAIL_FROM_RESPONSE'].$this->newline;
- return false;
- }
- // "To" address
- $this->sendCommand("RCPT TO: {$this->to}");
- $this->logArray['RCPT_TO_RESPONCE'] = $this->readResponse();
- if(substr($this->logArray['RCPT_TO_RESPONCE'],0,3) != '250')
- {
- $this->Error .= 'Mistake in reciepent address! '.$this->logArray['RCPT_TO_RESPONCE'].$this->newline;
- }
- // Send data to server
- $this->sendCommand('DATA');
- $this->logArray['DATA_RESPONSE'] = $this->readResponse();
- // Send mail message
- if (!$this->sendMail()) return false;
- // Good bye server! =)
- $this->sendCommand('QUIT');
- $this->logArray['QUIT_RESPONSE'] = $this->readResponse();
- // Close smtp connect
- fclose($this->smtpConnect);
- return true;
- }
- // Function send mail
- private function sendMail() {
- $this->sendHeaders();
- $this->sendCommand($this->message);
- $this->sendCommand('.');
- $this->logArray['SEND_DATA_RESPONSE'] = $this->readResponse();
- if(substr($this->logArray['SEND_DATA_RESPONSE'],0,3)!='250') {
- $this->Error .= 'Mistake in sending data! '.$this->logArray['SEND_DATA_RESPONSE'].$this->newline;
- return false;
- }
- return true;
- }
- // Function read response
- private function readResponse() {
- $data="";
- while($str = fgets($this->smtpConnect,4096))
- {
- $data .= $str;
- if(substr($str,3,1) == " ") { break; }
- }
- return $data;
- }
- // function send command to server
- private function sendCommand($string) {
- fputs($this->smtpConnect,$string.$this->newline);
- return ;
- }
- // function send headers
- private function sendHeaders() {
- $from = (($to2 == false)? $this->username_email : $to);
- $this->sendCommand("Date: ".date("D, j M Y G:i:s")." +0700");
- $this->sendCommand("From: <{$from}>");
- $this->sendCommand("Reply-To: <{$from}>");
- $this->sendCommand("To: <{$this->to}>");
- $this->sendCommand("Subject: {$this->subject}");
- $this->sendCommand("MIME-Version: 1.0");
- $this->sendCommand("Content-Type: text/html; charset={$this->charset}");
- if ($this->contentTransferEncoding) $this->sendCommand("Content-Transfer-Encoding: {$this->contentTransferEncoding}");
- return ;
- }
- public function __destruct() {
- if (is_resource($this->smtpConnect)) fclose($this->smtpConnect);
- }
- }
- ?>
The $smtpServer is the SMTP server that you are using. GMAIL does this, or you can use yours if you have one.
The $port is the port number for the SMTP server.
The $username is the username used to log-in to SMTP server.
The $password is the password used with the username to log-in to SMTP server.
The $username_email is your main email where the mails would be sent to.
The $localdomain is your domain.
And to use it with your information...
<?php
/* Some required variables to configure this page */
// Variables not to be sent to you
$blocked = array('submit1');
// The email address the result of the form would be sent to.
$adm_email = 'your_email@your_host.com'
// The prefix to the mail
$mail_prefix = 'A ' . $_POST['service'] . ' request was sent to you from ' . $_POST['firstname'] . ' ' . $_POST['lastname'] . '\r\n <hr />';
// The post (signature) to the mail
$mail_post = null;
// The title for the message
$title = 'A ' . $_POST['service'] . ' request was sent to you from ' . $_POST['firstname'] . ' ' . $_POST['lastname'];
/* The actual code body for sending */
// Initiating the body var
$body = $mail_prefix;
// Initiating some numeric values that would be incremented in the following loop
$blocked_num = 0;
// Building the body for the mail
foreach($_POST as $field_name => $field_value)
{
// Building the body for the mail with the correct fields
if($field_name != $blocked[$blocked_num])
$body .= "<strong>{$field_name}</strong>: {$_POST[$field_name]}<br />\r\n";
// Initiating the blocked num counter if needed
if(count($blocked) < $blocked_num)
++$blocked_num;
}
// Ending the body var
$body .= $mail_post;
// Trimming the ends of body from any unneeded white spaces
$body = trim($body);
// Requiring the SMTP class
require_once 'mail.php';
// Initiating the mail object
$mail = new mail();
// Sending the message
if(new mail($_POST['email'], $title, $body, true))
echo 'The mail was successfully sent. Thank you for your time!';
else
echo 'There was an error in the mailling service.';
?>
/* Some required variables to configure this page */
// Variables not to be sent to you
$blocked = array('submit1');
// The email address the result of the form would be sent to.
$adm_email = 'your_email@your_host.com'
// The prefix to the mail
$mail_prefix = 'A ' . $_POST['service'] . ' request was sent to you from ' . $_POST['firstname'] . ' ' . $_POST['lastname'] . '\r\n <hr />';
// The post (signature) to the mail
$mail_post = null;
// The title for the message
$title = 'A ' . $_POST['service'] . ' request was sent to you from ' . $_POST['firstname'] . ' ' . $_POST['lastname'];
/* The actual code body for sending */
// Initiating the body var
$body = $mail_prefix;
// Initiating some numeric values that would be incremented in the following loop
$blocked_num = 0;
// Building the body for the mail
foreach($_POST as $field_name => $field_value)
{
// Building the body for the mail with the correct fields
if($field_name != $blocked[$blocked_num])
$body .= "<strong>{$field_name}</strong>: {$_POST[$field_name]}<br />\r\n";
// Initiating the blocked num counter if needed
if(count($blocked) < $blocked_num)
++$blocked_num;
}
// Ending the body var
$body .= $mail_post;
// Trimming the ends of body from any unneeded white spaces
$body = trim($body);
// Requiring the SMTP class
require_once 'mail.php';
// Initiating the mail object
$mail = new mail();
// Sending the message
if(new mail($_POST['email'], $title, $body, true))
echo 'The mail was successfully sent. Thank you for your time!';
else
echo 'There was an error in the mailling service.';
?>
- <?php
- /* Some required variables to configure this page */
- // Variables not to be sent to you
- $blocked = array('submit1');
- // The email address the result of the form would be sent to.
- $adm_email = 'your_email@your_host.com'
- // The prefix to the mail
- $mail_prefix = 'A ' . $_POST['service'] . ' request was sent to you from ' . $_POST['firstname'] . ' ' . $_POST['lastname'] . '\r\n <hr />';
- // The post (signature) to the mail
- $mail_post = null;
- // The title for the message
- $title = 'A ' . $_POST['service'] . ' request was sent to you from ' . $_POST['firstname'] . ' ' . $_POST['lastname'];
- /* The actual code body for sending */
- // Initiating the body var
- $body = $mail_prefix;
- // Initiating some numeric values that would be incremented in the following loop
- $blocked_num = 0;
- // Building the body for the mail
- foreach($_POST as $field_name => $field_value)
- {
- // Building the body for the mail with the correct fields
- if($field_name != $blocked[$blocked_num])
- $body .= "<strong>{$field_name}</strong>: {$_POST[$field_name]}<br />\r\n";
- // Initiating the blocked num counter if needed
- if(count($blocked) < $blocked_num)
- ++$blocked_num;
- }
- // Ending the body var
- $body .= $mail_post;
- // Trimming the ends of body from any unneeded white spaces
- $body = trim($body);
- // Requiring the SMTP class
- require_once 'mail.php';
- // Initiating the mail object
- $mail = new mail();
- // Sending the message
- if(new mail($_POST['email'], $title, $body, true))
- echo 'The mail was successfully sent. Thank you for your time!';
- else
- echo 'There was an error in the mailling service.';
- ?>
I hope that made sense. And I hope that helps
About the PEAR thing. Make sure that Mail.php is in the correct directory and that the include code has the correct address to Mail.php
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
- mindfullsilence
- Proficient


- Joined: Aug 04, 2008
- Posts: 436
- Status: Offline
- mindfullsilence
- Proficient


- Joined: Aug 04, 2008
- Posts: 436
- Status: Offline
Can you post the code you got in 'sendemail.php'?
Although that isn't important. Let me try to explain this without seeing the code, but if you are still having some problems, could you please post the code here, unless you are afraid of people stealing your work.
include('Mail.php');
Whatever is in between the single-quotes " ' ", is the address to the file you want to include into the current file (sendemail.php). Is that address correct?
I may have worded something wrong, and if I did, I'm sorry
Although that isn't important. Let me try to explain this without seeing the code, but if you are still having some problems, could you please post the code here, unless you are afraid of people stealing your work.
include('Mail.php');
Whatever is in between the single-quotes " ' ", is the address to the file you want to include into the current file (sendemail.php). Is that address correct?
I may have worded something wrong, and if I did, I'm sorry
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
- mindfullsilence
- Proficient


- Joined: Aug 04, 2008
- Posts: 436
- Status: Offline
this is what is in the sendemail.php
<?php
include("Mail.php");
$name = $_REQUEST['firsstname'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['textarea'] ;
$subject = $_REQUEST['service'] ;
/* mail setup recipients, subject etc */
$recipients = "feedback@yourdot.com";
$headers["From"] = "$email";
$headers["To"] = "email@example.com";
$headers["Subject"] = "$subject";
$mailmsg = "$subject";
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "host.domain.com";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "username";
$smtpinfo["password"] = "password";
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
/* Ok send mail */
$mail_object->send($recipients, $headers, $mailmsg);
?>
<?php
include("Mail.php");
$name = $_REQUEST['firsstname'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['textarea'] ;
$subject = $_REQUEST['service'] ;
/* mail setup recipients, subject etc */
$recipients = "feedback@yourdot.com";
$headers["From"] = "$email";
$headers["To"] = "email@example.com";
$headers["Subject"] = "$subject";
$mailmsg = "$subject";
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "host.domain.com";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "username";
$smtpinfo["password"] = "password";
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
/* Ok send mail */
$mail_object->send($recipients, $headers, $mailmsg);
?>
- <?php
- include("Mail.php");
- $name = $_REQUEST['firsstname'] ;
- $email = $_REQUEST['email'] ;
- $message = $_REQUEST['textarea'] ;
- $subject = $_REQUEST['service'] ;
- /* mail setup recipients, subject etc */
- $recipients = "feedback@yourdot.com";
- $headers["From"] = "$email";
- $headers["To"] = "email@example.com";
- $headers["Subject"] = "$subject";
- $mailmsg = "$subject";
- /* SMTP server name, port, user/passwd */
- $smtpinfo["host"] = "host.domain.com";
- $smtpinfo["port"] = "25";
- $smtpinfo["auth"] = true;
- $smtpinfo["username"] = "username";
- $smtpinfo["password"] = "password";
- /* Create the mail object using the Mail::factory method */
- $mail_object =& Mail::factory("smtp", $smtpinfo);
- /* Ok send mail */
- $mail_object->send($recipients, $headers, $mailmsg);
- ?>
Use your words like arrows to shoot toward your goal.
- mindfullsilence
- Proficient


- Joined: Aug 04, 2008
- Posts: 436
- Status: Offline
bin/wamp/bin/php/php5.2.9-2/PEAR/Structures/Mail.php.
This file (mail.php) has these contents:
<?php
//
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Chuck Hagenbuch <chuck@horde.org> |
// +----------------------------------------------------------------------+
//
// $Id: Mail.php,v 1.17 2006/09/15 03:41:18 jon Exp $
require_once 'PEAR.php';
/**
* PEAR's Mail:: interface. Defines the interface for implementing
* mailers under the PEAR hierarchy, and provides supporting functions
* useful in multiple mailer backends.
*
* @access public
* @version $Revision: 1.17 $
* @package Mail
*/
class Mail
{
/**
* Line terminator used for separating header lines.
* @var string
*/
var $sep = "\r\n";
/**
* Provides an interface for generating Mail:: objects of various
* types
*
* @param string $driver The kind of Mail:: object to instantiate.
* @param array $params The parameters to pass to the Mail:: object.
* @return object Mail a instance of the driver class or if fails a PEAR Error
* @access public
*/
function &factory($driver, $params = array())
{
$driver = strtolower($driver);
@include_once 'Mail/' . $driver . '.php';
$class = 'Mail_' . $driver;
if (class_exists($class)) {
$mailer = new $class($params);
return $mailer;
} else {
return PEAR::raiseError('Unable to find class for driver ' . $driver);
}
}
/**
* Implements Mail::send() function using php's built-in mail()
* command.
*
* @param mixed $recipients Either a comma-seperated list of recipients
* (RFC822 compliant), or an array of recipients,
* each RFC822 valid. This may contain recipients not
* specified in the headers, for Bcc:, resending
* messages, etc.
*
* @param array $headers The array of headers to send with the mail, in an
* associative array, where the array key is the
* header name (ie, 'Subject'), and the array value
* is the header value (ie, 'test'). The header
* produced from those values would be 'Subject:
* test'.
*
* @param string $body The full text of the message body, including any
* Mime parts, etc.
*
* @return mixed Returns true on success, or a PEAR_Error
* containing a descriptive error message on
* failure.
* @access public
* @deprecated use Mail_mail::send instead
*/
function send($recipients, $headers, $body)
{
$this->_sanitizeHeaders($headers);
// if we're passed an array of recipients, implode it.
if (is_array($recipients)) {
$recipients = implode(', ', $recipients);
}
// get the Subject out of the headers array so that we can
// pass it as a seperate argument to mail().
$subject = '';
if (isset($headers['Subject'])) {
$subject = $headers['Subject'];
unset($headers['Subject']);
}
// flatten the headers out.
list(,$text_headers) = Mail::prepareHeaders($headers);
return mail($recipients, $subject, $body, $text_headers);
}
/**
* Sanitize an array of mail headers by removing any additional header
* strings present in a legitimate header's value. The goal of this
* filter is to prevent mail injection attacks.
*
* @param array $headers The associative array of headers to sanitize.
*
* @access private
*/
function _sanitizeHeaders(&$headers)
{
foreach ($headers as $key => $value) {
$headers[$key] =
preg_replace('=((<CR>|<LF>|0x0A/%0A|0x0D/%0D|\n|\r)\S).*=i',
null, $value);
}
}
/**
* Take an array of mail headers and return a string containing
* text usable in sending a message.
*
* @param array $headers The array of headers to prepare, in an associative
* array, where the array key is the header name (ie,
* 'Subject'), and the array value is the header
* value (ie, 'test'). The header produced from those
* values would be 'Subject: test'.
*
* @return mixed Returns false if it encounters a bad address,
* otherwise returns an array containing two
* elements: Any From: address found in the headers,
* and the plain text version of the headers.
* @access private
*/
function prepareHeaders($headers)
{
$lines = array();
$from = null;
foreach ($headers as $key => $value) {
if (strcasecmp($key, 'From') === 0) {
include_once 'Mail/RFC822.php';
$parser = &new Mail_RFC822();
$addresses = $parser->parseAddressList($value, 'localhost', false);
if (PEAR::isError($addresses)) {
return $addresses;
}
$from = $addresses[0]->mailbox . '@' . $addresses[0]->host;
// Reject envelope From: addresses with spaces.
if (strstr($from, ' ')) {
return false;
}
$lines[] = $key . ': ' . $value;
} elseif (strcasecmp($key, 'Received') === 0) {
$received = array();
if (is_array($value)) {
foreach ($value as $line) {
$received[] = $key . ': ' . $line;
}
}
else {
$received[] = $key . ': ' . $value;
}
// Put Received: headers at the top. Spam detectors often
// flag messages with Received: headers after the Subject:
// as spam.
$lines = array_merge($received, $lines);
} else {
// If $value is an array (i.e., a list of addresses), convert
// it to a comma-delimited string of its elements (addresses).
if (is_array($value)) {
$value = implode(', ', $value);
}
$lines[] = $key . ': ' . $value;
}
}
return array($from, join($this->sep, $lines));
}
/**
* Take a set of recipients and parse them, returning an array of
* bare addresses (forward paths) that can be passed to sendmail
* or an smtp server with the rcpt to: command.
*
* @param mixed Either a comma-seperated list of recipients
* (RFC822 compliant), or an array of recipients,
* each RFC822 valid.
*
* @return mixed An array of forward paths (bare addresses) or a PEAR_Error
* object if the address list could not be parsed.
* @access private
*/
function parseRecipients($recipients)
{
include_once 'Mail/RFC822.php';
// if we're passed an array, assume addresses are valid and
// implode them before parsing.
if (is_array($recipients)) {
$recipients = implode(', ', $recipients);
}
// Parse recipients, leaving out all personal info. This is
// for smtp recipients, etc. All relevant personal information
// should already be in the headers.
$addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false);
// If parseAddressList() returned a PEAR_Error object, just return it.
if (PEAR::isError($addresses)) {
return $addresses;
}
$recipients = array();
if (is_array($addresses)) {
foreach ($addresses as $ob) {
$recipients[] = $ob->mailbox . '@' . $ob->host;
}
}
return $recipients;
}
}
This file (mail.php) has these contents:
<?php
//
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Chuck Hagenbuch <chuck@horde.org> |
// +----------------------------------------------------------------------+
//
// $Id: Mail.php,v 1.17 2006/09/15 03:41:18 jon Exp $
require_once 'PEAR.php';
/**
* PEAR's Mail:: interface. Defines the interface for implementing
* mailers under the PEAR hierarchy, and provides supporting functions
* useful in multiple mailer backends.
*
* @access public
* @version $Revision: 1.17 $
* @package Mail
*/
class Mail
{
/**
* Line terminator used for separating header lines.
* @var string
*/
var $sep = "\r\n";
/**
* Provides an interface for generating Mail:: objects of various
* types
*
* @param string $driver The kind of Mail:: object to instantiate.
* @param array $params The parameters to pass to the Mail:: object.
* @return object Mail a instance of the driver class or if fails a PEAR Error
* @access public
*/
function &factory($driver, $params = array())
{
$driver = strtolower($driver);
@include_once 'Mail/' . $driver . '.php';
$class = 'Mail_' . $driver;
if (class_exists($class)) {
$mailer = new $class($params);
return $mailer;
} else {
return PEAR::raiseError('Unable to find class for driver ' . $driver);
}
}
/**
* Implements Mail::send() function using php's built-in mail()
* command.
*
* @param mixed $recipients Either a comma-seperated list of recipients
* (RFC822 compliant), or an array of recipients,
* each RFC822 valid. This may contain recipients not
* specified in the headers, for Bcc:, resending
* messages, etc.
*
* @param array $headers The array of headers to send with the mail, in an
* associative array, where the array key is the
* header name (ie, 'Subject'), and the array value
* is the header value (ie, 'test'). The header
* produced from those values would be 'Subject:
* test'.
*
* @param string $body The full text of the message body, including any
* Mime parts, etc.
*
* @return mixed Returns true on success, or a PEAR_Error
* containing a descriptive error message on
* failure.
* @access public
* @deprecated use Mail_mail::send instead
*/
function send($recipients, $headers, $body)
{
$this->_sanitizeHeaders($headers);
// if we're passed an array of recipients, implode it.
if (is_array($recipients)) {
$recipients = implode(', ', $recipients);
}
// get the Subject out of the headers array so that we can
// pass it as a seperate argument to mail().
$subject = '';
if (isset($headers['Subject'])) {
$subject = $headers['Subject'];
unset($headers['Subject']);
}
// flatten the headers out.
list(,$text_headers) = Mail::prepareHeaders($headers);
return mail($recipients, $subject, $body, $text_headers);
}
/**
* Sanitize an array of mail headers by removing any additional header
* strings present in a legitimate header's value. The goal of this
* filter is to prevent mail injection attacks.
*
* @param array $headers The associative array of headers to sanitize.
*
* @access private
*/
function _sanitizeHeaders(&$headers)
{
foreach ($headers as $key => $value) {
$headers[$key] =
preg_replace('=((<CR>|<LF>|0x0A/%0A|0x0D/%0D|\n|\r)\S).*=i',
null, $value);
}
}
/**
* Take an array of mail headers and return a string containing
* text usable in sending a message.
*
* @param array $headers The array of headers to prepare, in an associative
* array, where the array key is the header name (ie,
* 'Subject'), and the array value is the header
* value (ie, 'test'). The header produced from those
* values would be 'Subject: test'.
*
* @return mixed Returns false if it encounters a bad address,
* otherwise returns an array containing two
* elements: Any From: address found in the headers,
* and the plain text version of the headers.
* @access private
*/
function prepareHeaders($headers)
{
$lines = array();
$from = null;
foreach ($headers as $key => $value) {
if (strcasecmp($key, 'From') === 0) {
include_once 'Mail/RFC822.php';
$parser = &new Mail_RFC822();
$addresses = $parser->parseAddressList($value, 'localhost', false);
if (PEAR::isError($addresses)) {
return $addresses;
}
$from = $addresses[0]->mailbox . '@' . $addresses[0]->host;
// Reject envelope From: addresses with spaces.
if (strstr($from, ' ')) {
return false;
}
$lines[] = $key . ': ' . $value;
} elseif (strcasecmp($key, 'Received') === 0) {
$received = array();
if (is_array($value)) {
foreach ($value as $line) {
$received[] = $key . ': ' . $line;
}
}
else {
$received[] = $key . ': ' . $value;
}
// Put Received: headers at the top. Spam detectors often
// flag messages with Received: headers after the Subject:
// as spam.
$lines = array_merge($received, $lines);
} else {
// If $value is an array (i.e., a list of addresses), convert
// it to a comma-delimited string of its elements (addresses).
if (is_array($value)) {
$value = implode(', ', $value);
}
$lines[] = $key . ': ' . $value;
}
}
return array($from, join($this->sep, $lines));
}
/**
* Take a set of recipients and parse them, returning an array of
* bare addresses (forward paths) that can be passed to sendmail
* or an smtp server with the rcpt to: command.
*
* @param mixed Either a comma-seperated list of recipients
* (RFC822 compliant), or an array of recipients,
* each RFC822 valid.
*
* @return mixed An array of forward paths (bare addresses) or a PEAR_Error
* object if the address list could not be parsed.
* @access private
*/
function parseRecipients($recipients)
{
include_once 'Mail/RFC822.php';
// if we're passed an array, assume addresses are valid and
// implode them before parsing.
if (is_array($recipients)) {
$recipients = implode(', ', $recipients);
}
// Parse recipients, leaving out all personal info. This is
// for smtp recipients, etc. All relevant personal information
// should already be in the headers.
$addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false);
// If parseAddressList() returned a PEAR_Error object, just return it.
if (PEAR::isError($addresses)) {
return $addresses;
}
$recipients = array();
if (is_array($addresses)) {
foreach ($addresses as $ob) {
$recipients[] = $ob->mailbox . '@' . $ob->host;
}
}
return $recipients;
}
}
- <?php
- //
- // +----------------------------------------------------------------------+
- // | PHP Version 4 |
- // +----------------------------------------------------------------------+
- // | Copyright (c) 1997-2003 The PHP Group |
- // +----------------------------------------------------------------------+
- // | This source file is subject to version 2.02 of the PHP license, |
- // | that is bundled with this package in the file LICENSE, and is |
- // | available at through the world-wide-web at |
- // | http://www.php.net/license/2_02.txt. |
- // | If you did not receive a copy of the PHP license and are unable to |
- // | obtain it through the world-wide-web, please send a note to |
- // | license@php.net so we can mail you a copy immediately. |
- // +----------------------------------------------------------------------+
- // | Author: Chuck Hagenbuch <chuck@horde.org> |
- // +----------------------------------------------------------------------+
- //
- // $Id: Mail.php,v 1.17 2006/09/15 03:41:18 jon Exp $
- require_once 'PEAR.php';
- /**
- * PEAR's Mail:: interface. Defines the interface for implementing
- * mailers under the PEAR hierarchy, and provides supporting functions
- * useful in multiple mailer backends.
- *
- * @access public
- * @version $Revision: 1.17 $
- * @package Mail
- */
- class Mail
- {
- /**
- * Line terminator used for separating header lines.
- * @var string
- */
- var $sep = "\r\n";
- /**
- * Provides an interface for generating Mail:: objects of various
- * types
- *
- * @param string $driver The kind of Mail:: object to instantiate.
- * @param array $params The parameters to pass to the Mail:: object.
- * @return object Mail a instance of the driver class or if fails a PEAR Error
- * @access public
- */
- function &factory($driver, $params = array())
- {
- $driver = strtolower($driver);
- @include_once 'Mail/' . $driver . '.php';
- $class = 'Mail_' . $driver;
- if (class_exists($class)) {
- $mailer = new $class($params);
- return $mailer;
- } else {
- return PEAR::raiseError('Unable to find class for driver ' . $driver);
- }
- }
- /**
- * Implements Mail::send() function using php's built-in mail()
- * command.
- *
- * @param mixed $recipients Either a comma-seperated list of recipients
- * (RFC822 compliant), or an array of recipients,
- * each RFC822 valid. This may contain recipients not
- * specified in the headers, for Bcc:, resending
- * messages, etc.
- *
- * @param array $headers The array of headers to send with the mail, in an
- * associative array, where the array key is the
- * header name (ie, 'Subject'), and the array value
- * is the header value (ie, 'test'). The header
- * produced from those values would be 'Subject:
- * test'.
- *
- * @param string $body The full text of the message body, including any
- * Mime parts, etc.
- *
- * @return mixed Returns true on success, or a PEAR_Error
- * containing a descriptive error message on
- * failure.
- * @access public
- * @deprecated use Mail_mail::send instead
- */
- function send($recipients, $headers, $body)
- {
- $this->_sanitizeHeaders($headers);
- // if we're passed an array of recipients, implode it.
- if (is_array($recipients)) {
- $recipients = implode(', ', $recipients);
- }
- // get the Subject out of the headers array so that we can
- // pass it as a seperate argument to mail().
- $subject = '';
- if (isset($headers['Subject'])) {
- $subject = $headers['Subject'];
- unset($headers['Subject']);
- }
- // flatten the headers out.
- list(,$text_headers) = Mail::prepareHeaders($headers);
- return mail($recipients, $subject, $body, $text_headers);
- }
- /**
- * Sanitize an array of mail headers by removing any additional header
- * strings present in a legitimate header's value. The goal of this
- * filter is to prevent mail injection attacks.
- *
- * @param array $headers The associative array of headers to sanitize.
- *
- * @access private
- */
- function _sanitizeHeaders(&$headers)
- {
- foreach ($headers as $key => $value) {
- $headers[$key] =
- preg_replace('=((<CR>|<LF>|0x0A/%0A|0x0D/%0D|\n|\r)\S).*=i',
- null, $value);
- }
- }
- /**
- * Take an array of mail headers and return a string containing
- * text usable in sending a message.
- *
- * @param array $headers The array of headers to prepare, in an associative
- * array, where the array key is the header name (ie,
- * 'Subject'), and the array value is the header
- * value (ie, 'test'). The header produced from those
- * values would be 'Subject: test'.
- *
- * @return mixed Returns false if it encounters a bad address,
- * otherwise returns an array containing two
- * elements: Any From: address found in the headers,
- * and the plain text version of the headers.
- * @access private
- */
- function prepareHeaders($headers)
- {
- $lines = array();
- $from = null;
- foreach ($headers as $key => $value) {
- if (strcasecmp($key, 'From') === 0) {
- include_once 'Mail/RFC822.php';
- $parser = &new Mail_RFC822();
- $addresses = $parser->parseAddressList($value, 'localhost', false);
- if (PEAR::isError($addresses)) {
- return $addresses;
- }
- $from = $addresses[0]->mailbox . '@' . $addresses[0]->host;
- // Reject envelope From: addresses with spaces.
- if (strstr($from, ' ')) {
- return false;
- }
- $lines[] = $key . ': ' . $value;
- } elseif (strcasecmp($key, 'Received') === 0) {
- $received = array();
- if (is_array($value)) {
- foreach ($value as $line) {
- $received[] = $key . ': ' . $line;
- }
- }
- else {
- $received[] = $key . ': ' . $value;
- }
- // Put Received: headers at the top. Spam detectors often
- // flag messages with Received: headers after the Subject:
- // as spam.
- $lines = array_merge($received, $lines);
- } else {
- // If $value is an array (i.e., a list of addresses), convert
- // it to a comma-delimited string of its elements (addresses).
- if (is_array($value)) {
- $value = implode(', ', $value);
- }
- $lines[] = $key . ': ' . $value;
- }
- }
- return array($from, join($this->sep, $lines));
- }
- /**
- * Take a set of recipients and parse them, returning an array of
- * bare addresses (forward paths) that can be passed to sendmail
- * or an smtp server with the rcpt to: command.
- *
- * @param mixed Either a comma-seperated list of recipients
- * (RFC822 compliant), or an array of recipients,
- * each RFC822 valid.
- *
- * @return mixed An array of forward paths (bare addresses) or a PEAR_Error
- * object if the address list could not be parsed.
- * @access private
- */
- function parseRecipients($recipients)
- {
- include_once 'Mail/RFC822.php';
- // if we're passed an array, assume addresses are valid and
- // implode them before parsing.
- if (is_array($recipients)) {
- $recipients = implode(', ', $recipients);
- }
- // Parse recipients, leaving out all personal info. This is
- // for smtp recipients, etc. All relevant personal information
- // should already be in the headers.
- $addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false);
- // If parseAddressList() returned a PEAR_Error object, just return it.
- if (PEAR::isError($addresses)) {
- return $addresses;
- }
- $recipients = array();
- if (is_array($addresses)) {
- foreach ($addresses as $ob) {
- $recipients[] = $ob->mailbox . '@' . $ob->host;
- }
- }
- return $recipients;
- }
- }
Use your words like arrows to shoot toward your goal.
Does the filename has the capital 'M' or lowercase 'm'?
Try include("../../bin/php/php5.2.9-2/PEAR/Structures/Mail.php"); instead of include("Mail.php");
I don't know if that would work... I'm running out of ideas
Try include("../../bin/php/php5.2.9-2/PEAR/Structures/Mail.php"); instead of include("Mail.php");
I don't know if that would work... I'm running out of ideas
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
- mindfullsilence
- Proficient


- Joined: Aug 04, 2008
- Posts: 436
- Status: Offline
capitol.
I also have another with a lowercase located in the dir:
bin/wamp/bin/php/php5.2.9-2/PEAR/Mail/mail.php
it contains this code:
I also have another with a lowercase located in the dir:
bin/wamp/bin/php/php5.2.9-2/PEAR/Mail/mail.php
it contains this code:
<?php
//
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Chuck Hagenbuch <chuck@horde.org> |
// +----------------------------------------------------------------------+
//
// $Id: mail.php,v 1.18 2006/09/13 05:32:08 jon Exp $
/**
* internal PHP-mail() implementation of the PEAR Mail:: interface.
* @package Mail
* @version $Revision: 1.18 $
*/
class Mail_mail extends Mail {
/**
* Any arguments to pass to the mail() function.
* @var string
*/
var $_params = '';
/**
* Constructor.
*
* Instantiates a new Mail_mail:: object based on the parameters
* passed in.
*
* @param array $params Extra arguments for the mail() function.
*/
function Mail_mail($params = null)
{
/* The other mail implementations accept parameters as arrays.
* In the interest of being consistent, explode an array into
* a string of parameter arguments. */
if (is_array($params)) {
$this->_params = join(' ', $params);
} else {
$this->_params = $params;
}
/* Because the mail() function may pass headers as command
* line arguments, we can't guarantee the use of the standard
* "\r\n" separator. Instead, we use the system's native line
* separator. */
if (defined('PHP_EOL')) {
$this->sep = PHP_EOL;
} else {
$this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";
}
}
/**
* Implements Mail_mail::send() function using php's built-in mail()
* command.
*
* @param mixed $recipients Either a comma-seperated list of recipients
* (RFC822 compliant), or an array of recipients,
* each RFC822 valid. This may contain recipients not
* specified in the headers, for Bcc:, resending
* messages, etc.
*
* @param array $headers The array of headers to send with the mail, in an
* associative array, where the array key is the
* header name (ie, 'Subject'), and the array value
* is the header value (ie, 'test'). The header
* produced from those values would be 'Subject:
* test'.
*
* @param string $body The full text of the message body, including any
* Mime parts, etc.
*
* @return mixed Returns true on success, or a PEAR_Error
* containing a descriptive error message on
* failure.
*
* @access public
*/
function send($recipients, $headers, $body)
{
$this->_sanitizeHeaders($headers);
// If we're passed an array of recipients, implode it.
if (is_array($recipients)) {
$recipients = implode(', ', $recipients);
}
// Get the Subject out of the headers array so that we can
// pass it as a seperate argument to mail().
$subject = '';
if (isset($headers['Subject'])) {
$subject = $headers['Subject'];
unset($headers['Subject']);
}
/*
* Also remove the To: header. The mail() function will add its own
* To: header based on the contents of $recipients.
*/
unset($headers['To']);
// Flatten the headers out.
$headerElements = $this->prepareHeaders($headers);
if (PEAR::isError($headerElements)) {
return $headerElements;
}
list(, $text_headers) = $headerElements;
/*
* We only use mail()'s optional fifth parameter if the additional
* parameters have been provided and we're not running in safe mode.
*/
if (empty($this->_params) || ini_get('safe_mode')) {
$result = mail($recipients, $subject, $body, $text_headers);
} else {
$result = mail($recipients, $subject, $body, $text_headers,
$this->_params);
}
/*
* If the mail() function returned failure, we need to create a
* PEAR_Error object and return it instead of the boolean result.
*/
if ($result === false) {
$result = PEAR::raiseError('mail() returned failure');
}
return $result;
}
}
//
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Chuck Hagenbuch <chuck@horde.org> |
// +----------------------------------------------------------------------+
//
// $Id: mail.php,v 1.18 2006/09/13 05:32:08 jon Exp $
/**
* internal PHP-mail() implementation of the PEAR Mail:: interface.
* @package Mail
* @version $Revision: 1.18 $
*/
class Mail_mail extends Mail {
/**
* Any arguments to pass to the mail() function.
* @var string
*/
var $_params = '';
/**
* Constructor.
*
* Instantiates a new Mail_mail:: object based on the parameters
* passed in.
*
* @param array $params Extra arguments for the mail() function.
*/
function Mail_mail($params = null)
{
/* The other mail implementations accept parameters as arrays.
* In the interest of being consistent, explode an array into
* a string of parameter arguments. */
if (is_array($params)) {
$this->_params = join(' ', $params);
} else {
$this->_params = $params;
}
/* Because the mail() function may pass headers as command
* line arguments, we can't guarantee the use of the standard
* "\r\n" separator. Instead, we use the system's native line
* separator. */
if (defined('PHP_EOL')) {
$this->sep = PHP_EOL;
} else {
$this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";
}
}
/**
* Implements Mail_mail::send() function using php's built-in mail()
* command.
*
* @param mixed $recipients Either a comma-seperated list of recipients
* (RFC822 compliant), or an array of recipients,
* each RFC822 valid. This may contain recipients not
* specified in the headers, for Bcc:, resending
* messages, etc.
*
* @param array $headers The array of headers to send with the mail, in an
* associative array, where the array key is the
* header name (ie, 'Subject'), and the array value
* is the header value (ie, 'test'). The header
* produced from those values would be 'Subject:
* test'.
*
* @param string $body The full text of the message body, including any
* Mime parts, etc.
*
* @return mixed Returns true on success, or a PEAR_Error
* containing a descriptive error message on
* failure.
*
* @access public
*/
function send($recipients, $headers, $body)
{
$this->_sanitizeHeaders($headers);
// If we're passed an array of recipients, implode it.
if (is_array($recipients)) {
$recipients = implode(', ', $recipients);
}
// Get the Subject out of the headers array so that we can
// pass it as a seperate argument to mail().
$subject = '';
if (isset($headers['Subject'])) {
$subject = $headers['Subject'];
unset($headers['Subject']);
}
/*
* Also remove the To: header. The mail() function will add its own
* To: header based on the contents of $recipients.
*/
unset($headers['To']);
// Flatten the headers out.
$headerElements = $this->prepareHeaders($headers);
if (PEAR::isError($headerElements)) {
return $headerElements;
}
list(, $text_headers) = $headerElements;
/*
* We only use mail()'s optional fifth parameter if the additional
* parameters have been provided and we're not running in safe mode.
*/
if (empty($this->_params) || ini_get('safe_mode')) {
$result = mail($recipients, $subject, $body, $text_headers);
} else {
$result = mail($recipients, $subject, $body, $text_headers,
$this->_params);
}
/*
* If the mail() function returned failure, we need to create a
* PEAR_Error object and return it instead of the boolean result.
*/
if ($result === false) {
$result = PEAR::raiseError('mail() returned failure');
}
return $result;
}
}
- <?php
- //
- // +----------------------------------------------------------------------+
- // | PHP Version 4 |
- // +----------------------------------------------------------------------+
- // | Copyright (c) 1997-2003 The PHP Group |
- // +----------------------------------------------------------------------+
- // | This source file is subject to version 2.02 of the PHP license, |
- // | that is bundled with this package in the file LICENSE, and is |
- // | available at through the world-wide-web at |
- // | http://www.php.net/license/2_02.txt. |
- // | If you did not receive a copy of the PHP license and are unable to |
- // | obtain it through the world-wide-web, please send a note to |
- // | license@php.net so we can mail you a copy immediately. |
- // +----------------------------------------------------------------------+
- // | Author: Chuck Hagenbuch <chuck@horde.org> |
- // +----------------------------------------------------------------------+
- //
- // $Id: mail.php,v 1.18 2006/09/13 05:32:08 jon Exp $
- /**
- * internal PHP-mail() implementation of the PEAR Mail:: interface.
- * @package Mail
- * @version $Revision: 1.18 $
- */
- class Mail_mail extends Mail {
- /**
- * Any arguments to pass to the mail() function.
- * @var string
- */
- var $_params = '';
- /**
- * Constructor.
- *
- * Instantiates a new Mail_mail:: object based on the parameters
- * passed in.
- *
- * @param array $params Extra arguments for the mail() function.
- */
- function Mail_mail($params = null)
- {
- /* The other mail implementations accept parameters as arrays.
- * In the interest of being consistent, explode an array into
- * a string of parameter arguments. */
- if (is_array($params)) {
- $this->_params = join(' ', $params);
- } else {
- $this->_params = $params;
- }
- /* Because the mail() function may pass headers as command
- * line arguments, we can't guarantee the use of the standard
- * "\r\n" separator. Instead, we use the system's native line
- * separator. */
- if (defined('PHP_EOL')) {
- $this->sep = PHP_EOL;
- } else {
- $this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";
- }
- }
- /**
- * Implements Mail_mail::send() function using php's built-in mail()
- * command.
- *
- * @param mixed $recipients Either a comma-seperated list of recipients
- * (RFC822 compliant), or an array of recipients,
- * each RFC822 valid. This may contain recipients not
- * specified in the headers, for Bcc:, resending
- * messages, etc.
- *
- * @param array $headers The array of headers to send with the mail, in an
- * associative array, where the array key is the
- * header name (ie, 'Subject'), and the array value
- * is the header value (ie, 'test'). The header
- * produced from those values would be 'Subject:
- * test'.
- *
- * @param string $body The full text of the message body, including any
- * Mime parts, etc.
- *
- * @return mixed Returns true on success, or a PEAR_Error
- * containing a descriptive error message on
- * failure.
- *
- * @access public
- */
- function send($recipients, $headers, $body)
- {
- $this->_sanitizeHeaders($headers);
- // If we're passed an array of recipients, implode it.
- if (is_array($recipients)) {
- $recipients = implode(', ', $recipients);
- }
- // Get the Subject out of the headers array so that we can
- // pass it as a seperate argument to mail().
- $subject = '';
- if (isset($headers['Subject'])) {
- $subject = $headers['Subject'];
- unset($headers['Subject']);
- }
- /*
- * Also remove the To: header. The mail() function will add its own
- * To: header based on the contents of $recipients.
- */
- unset($headers['To']);
- // Flatten the headers out.
- $headerElements = $this->prepareHeaders($headers);
- if (PEAR::isError($headerElements)) {
- return $headerElements;
- }
- list(, $text_headers) = $headerElements;
- /*
- * We only use mail()'s optional fifth parameter if the additional
- * parameters have been provided and we're not running in safe mode.
- */
- if (empty($this->_params) || ini_get('safe_mode')) {
- $result = mail($recipients, $subject, $body, $text_headers);
- } else {
- $result = mail($recipients, $subject, $body, $text_headers,
- $this->_params);
- }
- /*
- * If the mail() function returned failure, we need to create a
- * PEAR_Error object and return it instead of the boolean result.
- */
- if ($result === false) {
- $result = PEAR::raiseError('mail() returned failure');
- }
- return $result;
- }
- }
Use your words like arrows to shoot toward your goal.
You were doing right. You were opening the Mail_smtp.php VIA factory in Mail.php... did you try the address I told you? Or that didn't work?
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
- mindfullsilence
- Proficient


- Joined: Aug 04, 2008
- Posts: 436
- Status: Offline
see this is the thing - I didn't write any of this code. I've tried adjusting it to work with my form but to no avail. I have these files, packages, addons, etc. for php - but have no idea what to do with them.
Most are from PEAR, I think I have some from phpcodeguru.org, and one from about.com. I have all these files and no idea how to use them.
I remember doing a site with a contact form and not having any trouble with it because the host set up all of the php on the server, and I simply wrote the form html and used the "post" action to push it to mail.php.
This time, however, I'm having to set up the smtp php and have no idea what I'm doing. I've never used php before. At this point, I don't know what I should put in my index.html, my root directory, my Mail.php or mail.php files. I'm lost
Most are from PEAR, I think I have some from phpcodeguru.org, and one from about.com. I have all these files and no idea how to use them.
I remember doing a site with a contact form and not having any trouble with it because the host set up all of the php on the server, and I simply wrote the form html and used the "post" action to push it to mail.php.
This time, however, I'm having to set up the smtp php and have no idea what I'm doing. I've never used php before. At this point, I don't know what I should put in my index.html, my root directory, my Mail.php or mail.php files. I'm lost
Use your words like arrows to shoot toward your goal.
- mindfullsilence
- Proficient


- Joined: Aug 04, 2008
- Posts: 436
- Status: Offline
sendemail.php is still giving me errors. I have changed the include and the "firsstname" to "firstname"
These are the errors I'm getting:
These are the errors I'm getting:
Warning: include(Mail.php) [function.include]: failed to open stream: No such file or directory in C:\USR\bin\wamp\www\voltec\sendemail.php on line 2
Warning: include() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='.;C:\php5\pear') in C:\USR\bin\wamp\www\voltec\sendemail.php on line 2
Warning: include() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='.;C:\php5\pear') in C:\USR\bin\wamp\www\voltec\sendemail.php on line 2
- Warning: include(Mail.php) [function.include]: failed to open stream: No such file or directory in C:\USR\bin\wamp\www\voltec\sendemail.php on line 2
- Warning: include() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='.;C:\php5\pear') in C:\USR\bin\wamp\www\voltec\sendemail.php on line 2
Use your words like arrows to shoot toward your goal.
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
June 25th, 2009, 9:10 am
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 40 posts
- Users browsing this forum: No registered users and 175 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum


