Re: HELP - Can't change Include Path
- From: shimmyshack <matt.farey@xxxxxxxxx>
- Date: 2 May 2007 21:44:35 -0700
On May 3, 3:15 am, cybervigilante <cybervigila...@xxxxxxxxx> wrote:
On May 2, 3:44 pm, shimmyshack <matt.fa...@xxxxxxxxx> wrote:
On May 2, 11:22 pm, cybervigilante <cybervigila...@xxxxxxxxx> wrote:
I can't seem to change the include path on my local winmachine noif you are running php as an apache module then you need to modify the
matter what I do.
php.ini that is in the apache/bin directory,
Okay, I did that. Good idea - wish I'd thought of it.;')
Unfortunately, my prog is still choking on a Pear. Error message is:
Warning: include(Mail.php) [function.include]: failed to open stream:
No such file or directory in C:\wamp\www\test\test.php on line 13
Warning: include() [function.include]: Failed opening 'Mail.php' for
inclusion (include_path='.;C:\wamp\php\PEAR') in C:\wamp\www\test
\test.php on line 13
Warning: include(Mail\mime.php) [function.include]: failed to open
stream: No such file or directory in C:\wamp\www\test\test.php on line
14
Warning: include() [function.include]: Failed opening 'Mail\mime.php'
for inclusion (include_path='.;C:\wamp\php\PEAR') in C:\wamp\www\test
\test.php on line 14
Fatal error: Class 'Mail_mime' not found in C:\wamp\www\test\test.php
on line 25
Here is my php.ini path for the php.ini in both php and sql dirs:
include_path = ".;C:\wamp\php\PEAR"
Here is the actual winpath to the pear directory: C:\wamp\php\PEAR
No difference. I'm stumped. Below is the test prog using Pear email,
which did work on the remote linux server and sent me some mail
wihtout the error msgs. Although my gmail acct picked the mail up as
an attachment instead of as html - but gmail is really wierd about
html email. I still haven't figured out what they accept, even though
I get a lot of html email from them, so something must work ;')
Frankly, I may abandon html email as a nuisance, but I need to test
pear with something to see if it works on my home system. If someone
has a simple illustrative test script using pear, that would help
since I can't send email from my home system anyway.
Oh, one other thing puzzled me about the prog below. I saw the html
message, which should be invisible, since it's inside a php code
block. Could be a php error,which brings up another point. I don't see
php errors online, like I do off. How do I make them display online
since that's the only place I have pear working so far, and I need to
see errors.
Just checked Yahoo mail, and the css formatted html came out fine.
Gmail making it an attachment must be a gmail bug, although I'd like
to know how I am getting html email from gmail, then ;')
Also, although the mail arrived, some echo statements I put in here
and there for a simpl trace (since deleted) didn't show up.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>PHP Guestbook</title>
</head>
<body>
<h1>mailtest</h1>
<?php
include('Mail.php');
include('Mail\mime.php');
$HTMLmsg = "<h2 style='color:red; background-color: Fuchsia; border:
thick
dotted; border-color: Blue; font-family: sans-serif; font-style:
italic; margin-left: 20%; padding: 20; margin-right: 30%;'>Test of
formatted email from <br>Just Health Now server, with html headers</
h2>";
$txtmsg = "Test of formatted email for Just Health Now server,
without html headers";
$message = new Mail_mime();
$message->setHTMLBody($HTMLmsg);
$message->setTXTBody($txtmsg);
$body = $message->get();
echo("after body = message get");
$extraheaders = array("From"=>"cybervigila...@xxxxxxxxx",
"Subject"=>"Test of HTML email");
$headers = $message->headers($extraheaders);
$mail = Mail::factory("mail");
$mail->send("cybervigila...@xxxxxxxxx", $headers, $body);
?>
</body>
</html>
try a trailing slash:
include_path='.;C:\wamp\php\PEAR\'
so that when you stipulate inclue(Mail.php) they will concatenate to
form
C:\wamp\php\PEAR\Mail.php as required
gmail does accept html mail, provided you do not send a txt
alternative, it prefers to display txt over html.
in your php.ini make sure
#show all errors
error_reporting = E_ALL
or
#show all but coding standards and warning msgs
error_reporting = E_ALL & ~E_NOTICE
and
display_errors = On
yuo should now see errors
#these are the rest of my ini settings
log_errors = On
ignore_repeated_errors = Off
ignore_repeated_source = Off
the in your scripts make sure you dont have
error_reporting(0);
anywhere
when you say you cant send email from your home, I am assuming that
you mean that the function
mail() doesnt work, unless you really do mean that your ISP blocks
port outgoing 25 TCP connections which is unusual but does happen.
You can get this working even on windows using sendmail.exe which is a
small exe that allows use of mail, and uses an extenal smtp server to
actually do the sending, so you create a mailbox somewhere for the
domain you are running locally. So if you are running www.mydomain.com
you create admin@xxxxxxxxxxxx (probably using a control panel with the
company through which you bought the domain name) and set up a user/
pass, then in your php.ini you have something like this:
[mail function]
sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
then in that directory, you must have the sendmail.exe and its ini
file:
smtp_server=mx.mydomain.com
auth_username=user
auth_password=pass
If you have no luck with using mail() or Mail.php pear class why not
try PHPMailer which is a great class that handles the connection to an
smtp server directly.
If you want to send an email /FROM/ your gmail account, securely over
SSL, by using phpmailer or sendmail, you must run some kind of proxy
that runs locally and which handles making the connection to gmail,
and exposes a "non-SSL" interface to your php script/sendmail.exe
I personally use stunnel running as a service bound to 127.0.0.1,
now your mail server IP becomes 127.0.0.1, so that the connection goes
to stunnel,
the stunnel.conf will have something like this inside:
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
debug = 7
output = stunnel.log
client = yes
[smtpg]
accept = 127.0.0.1:25
connect = smtp.gmail.com:465
;or connect = 72.14.215.109:465 so there's no DNS lookup
(get yourself a certificate pair, and you can even send encrypted mail
to your other geeky friends, and (paranoid?) people who work for large
firms which routinely read your mail; or you can just sign the mail
that comes from your php scripts, which is a nice touch I think.)
you can also use stunnel to ensure you can pick up your gmail msgs
too:
[popg]
accept = 127.0.0.1:9950
connect = pop.gmail.com:995
the brilliant thing is you can have more than one copy of sendmail.exe
on your system, each with its own ini file which makes a connection to
a different smtp server, you would then use something like:
$sendmail_exe = 'C:/another/sendmail/sendmail.exe -t';
exec($sendmail_exe . ' < "C:/body.txt"', $result);
where body.exe is that txt you intend to send via the secondary smtp
server and inside
C:/another/sendmail/sendmail.ini you have secondary server setings for
a new mailbox.
Im not sure why the echo statement did show anything.
final note: when sending html mail remember that using "old fashioned"
html might produce more predicatable results, tables etc... rather
than css. Of course try the css first, but from experience, css can
sometimes be parsed out, or interfered with by it inheriting from the
webmail application's style***. (of course td and so on can also
have styling applied to them, but I'm mainly talking about
positioning.
good luck
.
- Follow-Ups:
- Re: HELP - Can't change Include Path
- From: cybervigilante
- Re: HELP - Can't change Include Path
- References:
- HELP - Can't change Include Path
- From: cybervigilante
- Re: HELP - Can't change Include Path
- From: shimmyshack
- Re: HELP - Can't change Include Path
- From: cybervigilante
- HELP - Can't change Include Path
- Prev by Date: mod rewrite
- Next by Date: Determine contents of listbox
- Previous by thread: Re: HELP - Can't change Include Path
- Next by thread: Re: HELP - Can't change Include Path
- Index(es):