LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 02-04-2009, 02:37 PM   #1
swaves
LQ Newbie
 
Registered: Feb 2009
Posts: 3

Rep: Reputation: 0
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'],
 
Old 02-04-2009, 03:30 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,623
Blog Entries: 10

Rep: Reputation: 773Reputation: 773Reputation: 773Reputation: 773Reputation: 773Reputation: 773Reputation: 773
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
 
Old 02-04-2009, 03:47 PM   #3
swaves
LQ Newbie
 
Registered: Feb 2009
Posts: 3

Original Poster
Rep: Reputation: 0
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
 
Old 02-04-2009, 05:10 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,623
Blog Entries: 10

Rep: Reputation: 773Reputation: 773Reputation: 773Reputation: 773Reputation: 773Reputation: 773Reputation: 773
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?) ...
 
Old 02-04-2009, 05:26 PM   #5
swaves
LQ Newbie
 
Registered: Feb 2009
Posts: 3

Original Poster
Rep: Reputation: 0
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'],
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's the meaning of "PHP Parse error: parse error, unexpected $ in..." frandalla Programming 23 03-04-2009 12:34 PM
PHP Error Parse error: parse error, unexpected $ in /home/content/S/k/i/SkinCare4U/h CowanServices Programming 2 12-09-2008 08:26 PM
PHP parse error in config.inc.php.in Confusedious Linux - Software 2 11-03-2005 05:08 AM
PHP Parse error.....PHPBB bentman78 Linux - Software 0 07-09-2003 06:35 AM
php parse error wujimon Linux - Software 4 03-26-2003 02:37 PM


All times are GMT -5. The time now is 03:37 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration