Pages: 12Next
Current Page: 1 of 2
WAMP and PEAR 101? HelP
Posted by: webface (---.cpe.net.cable.rogers.com)
Date: March 18, 2008 01:44AM

Hi, i'm pretty new to WAMP e.t.c. I am trying to figure out how to get my mail scripts working.

<?php
require_once "Mail.php";


$fromname =$_POST["name"];
$fromaddress =$_POST["email"];
$from = $fromname." <".$fromaddress.">";

$recipient=$_POST["recipient"];

$to = "Recipient"." <".$recipient.">";
$subject = $_POST["subject"];

$body =$_POST["message"];

$host = "mail.abc.com";
$hostusername = "mail@abc.com";
$hostpassword = "abc";

$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $hostusername,
'password' => $hostpassword));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
print "&output=Failed to send email";
} else {
print "&output=Message Sent";
}
?>

///--------------------


When I try to run the script i get errors--
_____________________________

[17-Mar-2008 19:47:32] PHP Warning: require_once(Mail.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in E:\wamp\www\test\login.php on line 2

[17-Mar-2008 19:47:32] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'Mail.php' (include_path='.;C:\php5\pear') in E:\wamp\www\test\login.php on line 2



_____________________________


I kinda hacked this form script together that i use with flash forms on my server. I need to get it to work on WAMP so I dont have to do email script development online. My WAMP install was smooth and I've configured it as things came up. GD,imageMagick,exif e.t.c. My research has pointed out i need to install PEAR. Then I also read that WAMP comes with PEAR and there is indeed a PEAR folder inside php folder. All this folder contains is a file "go-pear.phar".

So my question is,..how do I configure/install/setup PEAR so I can use this form script. Please if you know how, provide a step by step guide to doing this. I'm searched online and cant find anything solid to go on.

cheers
webfaCe



Edited 1 time(s). Last edit at 03/18/2008 01:46AM by webface.

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: yfastud (Moderator)
Date: March 18, 2008 02:26AM

Either use dos command to run that file so it auto connect, download, and install PEAR, or you might want to download and install it yourself

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: webface (---.cpe.net.cable.rogers.com)
Date: March 18, 2008 02:34AM

How do i use the dos command to run the file? I dont quite speak dos.

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: webface (---.cpe.net.cable.rogers.com)
Date: March 18, 2008 03:39AM

I have pear installed and the include paths have been added to php.ini

I am still getting this error

Failed opening required 'Mail.php' (include_path='.;C:\php5\pear')

The php ini in the apache and php folder have no reference of this include path. Everything is installed on my E drive and there is no php5 folder in my C: drive. Where is this path coming from? How do I change it?

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: yfastud (Moderator)
Date: March 18, 2008 04:52AM


Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: toivo (---.belrs4.nsw.optusnet.com.au)
Date: March 18, 2008 01:10PM

Hi webface,

If your application comes with the program mail.php, why don't you just use the relative path from the current working directory to mail.php? At the moment, if the require function does not find mail.php in the current working directory, it tries the include_path, as defined in the php.ini file. The folders you see in the error message is the default setting after the installatin of PEAR.

I have used the phpMailer class, not the PEAR version, but according to the PEAR documentation at [pear.php.net], the mail.php program resides in /Mail-1.0.1/Mail.php. You should therefore add that folder (as a relative path) to the directories listed in include_path in php.ini. Or download and install phpMailer.

Regards,

toivo
nottingham, uk



Edited 1 time(s). Last edit at 03/18/2008 01:27PM by toivo.

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: webface (---.region1.highspeedunplugged.bell.ca)
Date: March 18, 2008 02:32PM

Can you include the full path to the /Mail-1.0.1/Mail.php? I cant find it on my system. I downloaded phpmailer. I unzipped it but it deosnt contain a mail.php. I'm confused again. Can someone give me a step by stepper to setting up or configuring mail.php. I have PEAR installed....great! but I need mail.php. Help Please

cheers,
webfaCe

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: webface (---.region1.highspeedunplugged.bell.ca)
Date: March 18, 2008 05:51PM

I have installed PEAR as wells as a couple of PEAR packages thru the command line. I'm not getting mail.php cant be found anymore so thats good. When I run the email script, nothing happens, the flash freezes and eventually I get a timeout error:

[18-Mar-2008 12:36:27] PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\KITS\login.php on line 3

I dunno what is causing this error. But I can smell i'm close to completing my wamp config. just this last hurdle.


thoughts and ideas welcome

cheers,
webfaCe

Options: ReplyQuote
Re: WAMP and PEAR 101? Some Progress but still problematic
Posted by: webface (---.cpe.net.cable.rogers.com)
Date: March 19, 2008 12:04AM

oK now I added the pear packages to my other computer and the same results as my work computer. When I run the mail script. Nothing happens of the flash end which is supposed to clear the form fields once it gets output back from the php and at then it says Waiting for localhost at the bottom of the browser for a long ass time then eventually it outputs "Failed to send email" to flash

Whole time theres nothing in the error logs. I have both path tp PEAR and \Mail\ in all the php.ini documents. Same error as mentioned above in the previous post just that it deosnt freeze. it stalls and waits for local host then eventually say "Failed to send email" which in the script posted


<? php
//----------

//-------part of script pasted above

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
print "&output=Failed to send email";
} else {
print "&output=Message Sent";
}

?>
//------------------------------------

I cant think of much else. I installed PEAR,the packages,used my outlook ISP settings for mail. There was no password line in there....hmm

Error logs are not helping cos there no error logs. Deos anybody know more about this stuff?

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: yfastud (Moderator)
Date: March 19, 2008 01:51AM

Quote

Deos anybody know more about this stuff?
Already answered this question that wamp doesn't come w/ mail server, so no matter how you change your codes, you can NOT send mail

BTW, it's not a good idea to have mail server, refer to this thread:

[forum.wampserver.com]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: toivo (---.nsw.bigpond.net.au)
Date: March 19, 2008 12:04PM

Hi webface,

If you ran the go-pear.bat file and installed PEAR, and then installed the Mail package with all its dependencies, you should now have the required files in your system, especially:

c:\wamp\bin\php\php5.2.5\PEAR\Mail.php

If you cannot find that file but you have PEAR installed, you can just run the following command to install the Mail package:

pear install --alldeps mail

Mail.php is the file where the Mail class and the factory function reside - remember Mail::factory(). You need to add the PEAR folder to the include_path in the php.ini which Apache uses.

Edit this php.ini:

c:\wamp\bin\apache\apache2.2.8\bin\php.ini

Find the following lines (fresh from a new install):

; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"

Uncomment the second line (remove the semicolon) and change it to:

include_path = ".;c:\wamp\bin\php\php5.2.5\PEAR"

Restart Apache.

Your script should now work.

By the way, are you sure your ISP's SMTP server requires you to present a username and password? Usually ISPs do not require that. In that case, change the line

'auth' => true,

to

'auth' => false,

In addition, if you want to use the Mail class from the command line interface (CLI), you need to add the PEAR folder to include_path in the file c:\wamp\bin\php\php5.2.5\php.ini. Sending emails from scheduled scripts like database backup is very handy.

In both configurations, in case you were to use just the mail() function in PHP, you must edit the php.ini file and make sure that the the SMTP parameter contains the domain name or IP address of the STMP server to which your application sends the messages.

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

However, your sample script sets the host address using the PEAR Mail class.

Be careful to scrub the email addresses for valid format to avoid surprises in the form of mail injection attempts. Do some reading on 'mail injection' and how to prevent it.

Regards,

toivo
nottingham, uk



Edited 1 time(s). Last edit at 03/19/2008 12:31PM by toivo.

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: webface (---.region1.highspeedunplugged.bell.ca)
Date: March 19, 2008 04:22PM

I have double checked and triple checked. The path to pear is included in my php.ini. I have set the smtp to my ISP and I am trying to use my online mail server settings in the php form. I'm still getting nothing. The form stalls, the browser bar says waiting for localhost. After a few minutes it still outputs "Failed to send email". I have tried this at home and at work with WAMP. What else could I do to get this going. Are there tests I can run that will perhaps give me an error to follow up on. Right now I'm getting no errors.
No form sent ...nothing. I tried toggling auth=>true and false on the form but no difference. It is very important that I get this set up.

yfastud:
I was asking how to configure mail to send off WAMP because I dont want to have to develop the mail side of an app online. I want to do it on my locahost. I dont really care about spammers e.t.c. WAMP is only on on my machine when i'm working or learning something but I dont want to have to upload a project online just to test a form out.

toivo:
I have pear and its dependencies installed, I'm not getting any errors to go on. lol, I'm actually wishing for an error message. Besides the include path in php.ini, should I be checking anything else?.

Please help if you can.

webfaCe

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: yfastud (Moderator)
Date: March 19, 2008 05:17PM

It's just a friendly reminder and of course nobody can stop you when you want it, just remember, spammers would detect and use your mail even before you know how to use it, and of course they will not ask you for permission at all :-(

BTW, wamp doesn't come w/ mail server, so this is not wamp issue; thus, I suggest you should seek help somewhere else. Thank you ;-)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: yfastud (Moderator)
Date: March 19, 2008 11:26PM

Sorry toivo, but I've already posted this is NOT wamp issue.

If you would like to help webface or any other users about mail, you guys should exchange through your own emails.

Thank you

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: toivo (203.19.130.---)
Date: March 19, 2008 11:46PM

Hi yfastud,

I thought the idea of this forum is to help people to use WAMP as a webserver. Sending emails is an essential part of the functionality of any webserver.

If some of users are not familiar with the intricacies of networking and mail, we should be able to at least point them to the right direction.

Regards,

toivo
nottingham, uk

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: yfastud (Moderator)
Date: March 20, 2008 12:27AM

In my own opinion, wamp doesn't come w/ mail server so we should not discuss it here, but if you really think it's an essential part, you can send email to Rom, the owner of this forum and let him make the decision

Thank you ;-)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: toivo (203.19.130.---)
Date: March 20, 2008 01:46AM

There is no need to discuss the fact that WAMP does not come with a mail server, in other words a mail server is not bundled into WAMP, and I am not suggesting that it should. However, as I said, "Sending emails is an essential part of the functionality of any webserver". That functionality is independent of where the actual mail server is running.

The standard PHP implementation fully supports sending emails through the mail() function or modules like phpMailer and PEAR::Mail. The IMAP extension of PHP even supports reading emails from mailboxes which of course have to reside in a mail server but, again, that mail server can be hosted anywhere. Both of these email functions work in the WAMP environment.

Regards,

toivo
nottingham, uk

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: davecampbell (---.dhcp.insightbb.com)
Date: March 20, 2008 06:14AM

I totally agree with toivo and applaud his detailed explanation of these critical application functions.

Without this thread, I would be totally lost with Pear and I need to have those identical mailing functions operational in my application.

Please don't scare toivo away with the fairly lame dismissive comments about WAMP and mail servers.

toivo exemplifies what makes open source so excellent and lame dismissive comments are what makes the internet so bogus. No offense yfastud, but toivo's helpful, tolerant, and deferential demeanor should be held high, even emulated, not slammed.

With respect to all,

Dave

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: webface (---.cpe.net.cable.rogers.com)
Date: March 21, 2008 01:18AM

Gentlemen,

the matter has indeed been resolved much thanks and regards to toivo and his suggestion is a private message.

First I used the telnet command to connect to the server. It kept failing as i trying to connect to my online server. then with telnet i was able to make a connection to my isp

Then i checked pear install with command line and peeked around everything loooked ok. I found i had to download 2 Mail dependent packages as i didnt use --alldeps to download it all the first time. Learning is funn!

The reason i was getting so frustrated earlier was i was seeking help on 2 seperate wamp installs and applying the checks i learned of on both when in fact they were on seperate ISPs and had different protocols

Then I decided to start from the simplest php form i could find. They all failed but one gave an error authentication failed which was music to my ears....

My form script was not wrong but the smtp was for my online site which i assumed on my work install would work as that ISP didnt require SMTP settings for our OUTLOOK software...but at home the ISP had made me get a user account with settings for my outlook to work so i entered those settings and voila It works just like I wanted. I am overwhelmed with joy now.

I have 2 questions

1. My web host told me smtp authenticated form mail is the only way to guarantee your mail deosnt get caught in server queues so is why i use this script now. It works great and I have no complaints. I was just wondering your thoughts on this and also to the validity of their claim.

2. I can now send smtp mail from my wamp and authentication is required everytime, do you still think spammers can attack my port and send messages from there? I'm not an expert but i dont think so.

Thank you very much both of you for your insight especially you toivo. Your help made me not to give up hope. yfastud I thank you too but please remember people come here looking for help and barely know what theyre doing and you can be rather harsh.

I dunno if I will get smtp to work at my job install because that ISP deosnt use auth, however I was able to get generic mail scripts to run on there again with toivo's insights. so i'm content.

Now to really learn php and mysql.

webfaCe

Options: ReplyQuote
Re: WAMP and PEAR 101? HelP
Posted by: toivo (203.19.130.---)
Date: March 21, 2008 01:38AM

Hi,

I am glad it worked out :-)

You are just sending mail to your ISP. This means that your WAMP server connects to TCP port 25 in the SMTP server of your ISP. That operation does not open port 25 in your server at all because you are not running a mail server (which listens to incoming connections on port 25).

You need to make sure your MX records are all right if you use your own domain, otherwise you may have problems with some anti-spam appliances and mail servers which do a reverse DNS lookup to verify the originating IP address. AOL has been notoriously rejecting all emails coming from servers considered to be in a dynamic or residential range of IP addresses.

Cheers,

toivo
nottingham, uk

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


Sorry, only registered users may post in this forum.