I have a couple of problems playing around with mail and ftp aspect of php.
I'm on windows Xp with xampp 1.6.5.
the major problem is about filezilla server. i have two default users anonymous and newuser which are enabled and the server is a service that starts at startup.
my codes :
i'am having the same message of the first die even after trying the loopback address 127.0.0.1
- Code: Select all
<?php
set_time_limit(0);
if (!pointer = ftp_connect('localhost'))
{
die('could not connect to ftp server');
}
if(!ftp_login($pointer,'newuser','wampp'))
{
die('login failed');
}
?>
any idea?
the second problem is about the PEAR Mail package.
the problem is that, a mail send with mail class doesn't show the subject here is the code
- Code: Select all
<?php
error_reporting(E_ALL);
include_once('Mail.php');
$mail = Mail::factory('mail');
$headers = array('from' => 'postmaster@localhost', 'Subject' => 'PEAR');
$go=$mail->send('admin@localhost',$headers,'this is send with the pear mail factory with subject');
if(PEAR::isError($go))
{
//some echo with $go->getMessage();
}
else
{
//some message
}
?>
don't know why can't see this the subject in my outlook express.but can it if it's sent with built in mail function i see the subject.
the third problem is about SMTP.my mercury is (i guess) working properly
still with pear i see:mail sendind failed :Failed to connect to smtp.localhost:25 [SMTP: Failed to connect socket: (code: -1, response: )]
after running this
- Code: Select all
<?php
include_once('Mail.php');
$mail = Mail::factory('smtp', array('host' => 'smtp.localhost'));
$headers = array('From' => 'postmaster@localhost', 'CC' => 'newuser@localhost', 'Subject' => 'Carbon Copy');
$go = $mail->send('admin@localhost',$headers, 'a try with pear for carbon copy');
if(PEAR::isError($go))
{
//some echo with $go->getMessage();
}
else
{
//some message
}
?>
in my php.ini i change in [mail -function] SMTP = smtp.localhost but still
any idea? thanks