In my cPanel domain and account, I am creating a simple HTML and CSS business website that uses PHP to send an email notification to request an estimate or to contact the business.
I created a cPanel email account to handle these type of emails, which I am using in my php script with the corresponding uid and pwd.
Currently I have the HTML, CSS, and PHP all together in one file that I call estimate.php
My html, images, php, and css files are in the .../www directory and the installed PHP extensions and apps are in the .../php directory
Note that my cpanel setup from pear.php.net already has the following Installed PHP Extension(s) and Application(s)
<> Auth_SASL 1.0.6
<> Mail 1.2.0
<> Net_SMTP 1.6.2
<> Net_Socket 1.0.14
To me it seems like I have everything I need, I just need to link or glue all the pieces together. When I try to go to the estimate.php page via an IE web browser I get the following error:
Line 49 would be require_once "../php/Mail.php"; It can't find the php/Mail.php file, but is there...
It seems like the 'ROOT_PATH' is Not defined; I can't find the php.ini file and I don't know how to define the 'ROOT_PATH'.
I created a cPanel email account to handle these type of emails, which I am using in my php script with the corresponding uid and pwd.
Currently I have the HTML, CSS, and PHP all together in one file that I call estimate.php
PHP:
<?php
[B]require_once "../php/Mail.php";[/B]
require_once "../php/smtp.php";
require_once "../php/Net/SMTP.php";
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$company = $_POST['company'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$formMessage = $_POST['message'];
$to = '<username>@<mycpaneldomain.com>';
$subject = '[TEST] Free Estimate or Quote Request';
$headers = "From: " . strip_tags($_POST['email']) . "\r\n";
$headers .= "Reply-To: ". strip_tags($_POST['email']) . "\r\n";
$headers .= "CC: [email]<anotheremail>@yahoo.com[/email]\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//Incoming and Outgoing Server <mail.hostname.com>
$host = "ssl://<mail.hostname.com>";
$port = "465"; //SMTP: Port 465 IMAP: Port 993 POP3: Port 995
$username = "<estimate>@<mycpaneldomain.com>";
$password = "<password>";
$smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if(PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>
</head>
<body>
<div class="wrapper">
<header>
........................
</header>
........................
<form method="post" action="estimate.php">
<fieldset>
<legend><h3>Free Estimate or Quote</h3></legend>
<p>
<label class="title" for="FirstName">First Name:</label>
<i>*</i>
<input type="text" name="FirstName" id="FirstName" size="300" maxlength="400" title="Enter your first name.">
<br />
<label class="title" for="LastName">Last Name:</label>
<i>*</i>
<input type="text" name="LastName" id="LastName" size="300" maxlength="400" title="Enter your last name.">
<br />
<label class="title" for="company">Company:</label>
<i>*</i>
<input type="text" name="company" id="company" size="300" maxlength="400" title="What's the name of your company or organization?">
<br />
<label class="title" for="email">Your email:</label>
<i>*</i>
<input type="text" name="email" id="email" size="300" maxlength="400" title="Enter your email address.">
<br />
<label class="title" for="phone">Phone:</label>
<i>*</i>
<input type="text" name="phone" id="phone" size="300" maxlength="400" title="Enter your phone number.">
<br />
<label for="message">Question(s) and/or Comment(s):</label>
<textarea name="message" id="message" cols="72" rows="5" title="Enter your questions and/or comments."></textarea>
</p>
<div class="submit"><input type="submit" id="submit" value="GET IT NOW" /></div>
</fieldset>
</form>
My html, images, php, and css files are in the .../www directory and the installed PHP extensions and apps are in the .../php directory
Note that my cpanel setup from pear.php.net already has the following Installed PHP Extension(s) and Application(s)
<> Auth_SASL 1.0.6
<> Mail 1.2.0
<> Net_SMTP 1.6.2
<> Net_Socket 1.0.14
To me it seems like I have everything I need, I just need to link or glue all the pieces together. When I try to go to the estimate.php page via an IE web browser I get the following error:
Code:
Warning: require_once(../php/smtp.php) [function.require-once]: failed to open stream: No such file or directory in ../public_html/estimate.php on line 49
Fatal error: require_once() [function.require]: Failed opening required '../php/smtp.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in <mycpanle_home_root>/public_html/estimate.php on line 49
Line 49 would be require_once "../php/Mail.php"; It can't find the php/Mail.php file, but is there...
It seems like the 'ROOT_PATH' is Not defined; I can't find the php.ini file and I don't know how to define the 'ROOT_PATH'.