LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Parse error in PhP (https://www.linuxquestions.org/questions/linux-newbie-8/parse-error-in-php-702317/)

swaves 02-04-2009 02:37 PM

Parse error in PhP
 
This is new to me, but I am trying to make the "send mail" function work on my flash page. Any help would be greatly appriciated, I have been working on this for 3 days now
Here is the info:

ERROR MESSAGE:
Warning: main(Mail.php): failed to open stream: No such file or directory in /u34/swaves/email tutorial/php/sendtofriend.php on line 4

Fatal error: main(): Failed opening required 'Mail.php' (include_path='.:/usr/local/php/include') in /u34/swaves/email tutorial/php/sendtofriend.php on line 4

RELATED DOCUMENTS
SENDFRIEND.PHP -

PHP Code:

<?php

include("config.php");
require_once "Mail.php";

$job=$_REQUEST["job"];

if($job=="sendtofriend")
{
$yname=$_REQUEST["yname"];
$yemail=$_REQUEST["yemail"];
$fname=$_REQUEST["fname"];
$femail=$_REQUEST["femail"];
$message=$_REQUEST["Message"];
$url=$_REQUEST["Url"];


$msg="Your friend <b>".$yname."</b> (".$yemail.") sent you this article!<br>";
$msg.="<br><br><a href=".$url."> Click here to view article</a>";
$msg.="<br><br>".$url;
$msg.="<br><br>Your friend's message:<br><br>".$message;

$subject=$yname." sent you an article!";

//echo SendEmail($GLOBALS['fromName']."<".$GLOBALS['fromEmail'].">",$femail,$subject,$msg);
echo SendEmail($femail,$subject,$msg);

} else {
echo("action=error occured");
}

?>


MAIL.PHP -

PHP Code:

<?php
define("_MAIL_MSGBODY", "Message body is not set.");
define("_MAIL_FAILOPTPL", "Failed opening template file.");
define("_MAIL_FNAMENG", "From Name is not set.");
define("_MAIL_FEMAILNG", "From Email is not set.");
define("_MAIL_SENDMAILNG", "Could not send mail to %s.");
define("_MAIL_MAILGOOD", "Mail sent to %s.");
define("_MAIL_SENDPMNG", "Could not send private message to %s.");
define("_MAIL_PMGOOD", "Private message sent to %s.");
?>


CONFIG.PHP - personal data *** out

PHP Code:

<?php


#Change the value of the following variables according to your configuration

$smtphost = "smtp.****"; #SMTP Server name/IP
$smtpport = 25; #Change to your SMTP server port if not 25
$username = "***@****.com"; #SMTP UserName
$password = "****"; #SMTP Password
$fromName = "****"; #A default name value to indicate where the email is from
$fromEmail = "****"; #A default email value to indicate where the email is from


function SendEmail ($strFrom,$strTo,$strSubject,$strMailBody){
$headers = array ('From' => $strFrom,
'To' => $strTo,
'Content-Type' => "text/html; charset=ISO-8859-1",
'Subject' => $strSubject);

$smtp = Mail::factory('smtp',
array ('host' => $GLOBALS['smtphost'],
'auth' => true,
'port' => $GLOBALS['smtpport'],

Tinkster 02-04-2009 03:30 PM

Hi,

welcome to lq!

And the obvious questions:

Does Mail.php reside in /usr/local/php/include, what is the layout of
your file-system and/or directory tree?


Cheers,
Tink

swaves 02-04-2009 03:47 PM

The "Mail.php" is in path /u34/swaves/cgi-bin
Is this the correct folder for that file?
Thanks for the reply...still working on this :(

Tinkster 02-04-2009 05:10 PM

php files do *not* live in cgi-bin, traditionally, but in
the web-servers document root (or wherever your virtual host
has its document root). If the file is in the current working
directory and can't be found it may be an issue of case (real
file spelt mail.php, script looking for Mail.php?) ...

swaves 02-04-2009 05:26 PM

Worked...But :)
 
That corrected that problem.....Thanks!
But now I go this

Warning: Missing argument 4 for sendemail() in /u34/swaves/email tutorial/php/config.php on line 14

Fatal error: Undefined class name 'mail' in /u34/swaves/email tutorial/php/config.php on line 20


LINE 14 function SendEmail ($strFrom,$strTo,$strSubject,$strMailBody){
$headers = array ('From' => $strFrom,
'To' => $strTo,
'Content-Type' => "text/html; charset=ISO-8859-1",
'Subject' => $strSubject);

LINE 20 $smtp = Mail::factory('smtp',
array ('host' => $GLOBALS['smtphost'],


All times are GMT -5. The time now is 04:42 PM.