FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP mailing script





htmlrules
can anyone give me a working mailing script
this is the script im using though it aint working

Code:
<php?
   $daQuery = $_POST['querybox'];
   $daEmail = $_POST['emailbox'];
   $daUsername = $_POST['namebox'];
   $daUrgency = $_POST['urgencybox'];
   
   require("c:\php\includes\class.phpmailer.php");
   $mail = new PHPMailer();   
   $mail->IsSMTP();
   $mail->Host = "";
   $mail->SMTPAuth = true;
   $mail->Username = "";
   $mail->Password = "";   
   $mail->From = "$daUsername";
   $mail->FromName = " ";
   $mail->AddAddress("");
   $mail->IsHTML(true);
   $mail->Subject = "$daUsername";
   $mail->Body = "$daUsername has got a $daUrgency $daQuery svaed in the $daQuery database";
   $mail->Send();
?>


can anyone tell me why it is working you can see the errors at
http://w3bs.frih.net/contactus.php
or here are the errors ive copy and pasted

Warning: main(c:\php\includes\class.phpmailer.php) [function.main]: failed to open stream: No such file or directory in /home/htmlrule/domains/w3bs.frih.net/public_html/checkform.php on line 121

Warning: main(c:\php\includes\class.phpmailer.php) [function.main]: failed to open stream: No such file or directory in /home/htmlrule/domains/w3bs.frih.net/public_html/checkform.php on line 121

Fatal error: main() [function.require]: Failed opening required 'c:\php\includes\class.phpmailer.php' (include_path='.:/usr/local/lib/php') in /home/htmlrule/domains/w3bs.frih.net/public_html/checkform.php on line 121

by the way line 121 is

Code:
   require("c:\php\includes\class.phpmailer.php");


willing to pay 540 frih to the first person who can give me a response that works
muggle
htmlrules wrote:
Code:
   require("c:\php\includes\class.phpmailer.php");


Just a quick guess here, but aren’t you supposed to double the \ character in the quoted strings? (i.e. “c:\\php\\includes\\class.phpmailer.php”)
jabapyth
muggle wrote:
htmlrules wrote:
Code:
   require("c:\php\includes\class.phpmailer.php");


Just a quick guess here, but aren’t you supposed to double the \ character in the quoted strings? (i.e. “c:\\php\\includes\\class.phpmailer.php”)

thats the only problem I can see with it
NeShYU
This should work:
Code:
<?php
@require('contact_config.php');

if(isset($_POST["send"]))
{
$name = $_POST["name"];
$url = $_POST["url"];
$email = $_POST["email"];
$subject = "Contact";
$msg = $_POST["msg"];
$vword = $_POST["vword"];
$ip = $_SERVER['REMOTE_ADDR'];


if(empty($name))
{
echo(" - <strong>Enter your name please!</strong><br />");
}
// CHECK IF EMAIL IS VALID ////////////////////////////////////////////////////////////////////
function CheckMail($email) {
if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4}$", $email)) { return true; }
else { return false; }
}
if ((empty($email)) || (!CheckMail($email)))
{
echo " - <strong>Your email is invalid!!</strong><br />";
}
// CHECK IF EMAIL IS VALID ////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////

// CHECK IF THE FORM HAS BEEN FILLED
if(empty($msg)){
echo(" - <strong>Please enter a message!</strong><br />");
}
if(empty($vword)){
echo(" - <strong>Please enter a The Verification word!!</strong><br />");
}
////////////////////////////////////////////////////////////////////
// IF THEIR ARE NOT EMPTY
if(!empty($name) && !empty($email) && !empty($msg) && !empty($vword))
{
   if($vword != "verify")
      { echo "<strong>Wrong Verification Word!!</strong>"; }
         if($vword == "verify")
             {
$headers .= "From: ".$email."";
// WE STORE THE MESSAGE IN A VARIABLE
$messageproper =
"From: $name - $email \n" .
"------------------------- $yoursitename -------------------------\n\n" .
"Name: $name\n\n" .
"Subject: Contact\n\n" .
"Site Url: $url\n\n" .
"Email: $email\n\n" .
"Message: $msg\n\n" .
"Sender Ip: $ip\n\n" .

"\n------------------------------------------------------------\n";

mail("$receiver", $subject, $messageproper, "From: $yoursitename <$email>");
echo( '<br />
<blockquote>
Thank You <strong>' . $name . '</strong>, your message was sent!! <br />
And for security reasons, your IP was recorded <strong> IP: ' .$ip .'</strong><br />
<div align="center">Please click <a href="' . $homepage . '">here</a> to go back</div>
</blockquote>
' );
            }
}

}
else
{

?>
<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<h4 class="left">Name:</h4>

<span class="left">
<input type="text" name="name" size="35" />
</span>
<h4 class="left">Email:</h4>

<span class="left">
<input type="text" name="email" size="35" />
</span>
<h4 class="left">Website:</h4>

<span class="left">
<input type="text" name="url" size="35" />
</span>
<h4 class="left">Message:</h4>

<span class="left">
<textarea name="msg" rows="5" cols="35"></textarea>
</span>
<h4 class="left">Verification Word: verify</h4>

<span class="left">
<input type="text" name="vword" size="35" />

</span>
<h4 class="left">&nbsp;</h4>

<span class="left">
<input type="submit" name="send" value="Send Email!" />
<input type="reset" value="Reset Form!" />
</span>
</form>

and this is file contact_config.php:
Code:
<?php

// ADAIXO Systems script
// Please configure this variables below.

$receiver = "you@site.com"; // Your email.
$v_w = "verify"; // Write a word for the user to write, in order to unable bots to send emails.
$yoursitename = "My Site"; // Write your site name.
$homepage = "http://www.site.com";
?>

You can rename contact_config.php to anything, but you must change the following line in first file (which you can name anyway you want):
Code:
@require('contact_config.php');

I hope that this will do the job
hexkid
NeShYU wrote:
Code:
// CHECK IF EMAIL IS VALID ////////////////////////////////////////////////////////////////////
function CheckMail($email) {
if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4}$", $email)) { return true; }
else { return false; }
}
if ((empty($email)) || (!CheckMail($email)))
{
echo " - <strong>Your email is invalid!!</strong><br />";
}
// CHECK IF EMAIL IS VALID ////////////////////////////////////////////////////////////////////


This does not validate all valid e-mail addresses.
For that you need something like this regular expression Smile
NeShYU
I used that script and worked well Smile
Related topics
Hot or Not PHP-Nuke script
What's the best PHP Wiki script?
problem with a php randomizer script
Install PHP Teamspeak script
php mailing script
[php]putting script fragments together?
Php voting script needed (URGENT)
PHP Get script name?
PHP logging script
I need a php upload script, NEEDED BADLY
PHP contact script...
Php No Spam Mass Mailing Script
need help in a simple php register script based on flat file
Need Help-- Order Form in Flash
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.