Page 1 of 1
Question about mail()
Posted: Thu Jul 25, 2002 3:22 pm
by matthiasone
Posted: Thu Jul 25, 2002 1:20 pm Post subject: use the mail() function
--------------------------------------------------------------------------------
I am have touble sending mail using the mail function in PHP. I beleive the path is sent right for sendmail. when I run the function, I get a false returned from the function. Is there a way to determine why it returned a false?
MatthiasOne
Posted: Thu Jul 25, 2002 3:27 pm
by llimllib
Well, I'm gonna come in ahead of Twinglet, and say that it's not polite to cross-post. This question really belongs here, not in Databases.
That said, try and send a piece of mail from the command line; make sure exactly what you type there goes into php.ini. After that...well, that's all I can come up with right now.
Posted: Thu Jul 25, 2002 3:32 pm
by matthiasone
I know..........I posted before I realized what forum I was in...........sorry
Posted: Thu Jul 25, 2002 3:46 pm
by llimllib
i figured that was the case, and it's not a problem, just letting you know. Don't worry about it.
Did you try to send a piece of mail from the command line?
Posted: Fri Jul 26, 2002 1:51 am
by twigletmac
Well, I'm gonna come in ahead of Twinglet, and say that it's not polite to cross-post.

Someone has to keep everybody in line.
matthiasone - which operating system are you running?
Mac
Posted: Fri Jul 26, 2002 9:05 am
by matthiasone
Unix (FreeBBS) on the web server
Posted: Fri Jul 26, 2002 9:21 am
by llimllib
do you have shell access?
Posted: Fri Jul 26, 2002 9:23 am
by matthiasone
No, just ftp access
Posted: Fri Jul 26, 2002 9:28 am
by llimllib
could you perhaps email an admin and ask him to check your sendmail location? Do you definitely have sendmail access?
Otherwise, if you have an SMTP server anywhere, you could use the PEAR::smtp class to send mail. You can make it appear to be from you no matter what smtp server it goes through, and it's probably more portable anyway.
Posted: Fri Jul 26, 2002 9:34 am
by matthiasone
Well we (the admin and I) have already verified the send mail location, though it does contain an "-t -i" after the path that we are not sure what that means. I think I have sendmail access.......at least that is what I was told by the admin.
How does that PEAR::SMTP work..........we have a mail server (Exchange) on a different server
Posted: Fri Jul 26, 2002 10:42 am
by llimllib
Ok, there's no manual at the normal pear site, but there is a manual for pear::smtp
here. The code sample they give is:
Code: Select all
<?php
include('Mail.php');
$recipients = 'joe@example.com';
$headersї'From'] = 'richard@phpguru.org';
$headersї'To'] = 'joe@example.com';
$headersї'Subject'] = 'Test message';
$body = 'Test message';
$paramsї'host'] = 'mail.example.com';
// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory('smtp', $params);
$mail_object->send($recipients, $headers, $body);
?>
The classes you need are: pear/Mail.php; pear/mail/smtp.php; pear/net/smtp.php; pear/net/socket.php. If you don't have any of them, go to cvs.php.net and look in the pear directory to download them, or I'll email them to you if you want. You can set authorization in the $params, look at the manual page.
Posted: Fri Jul 26, 2002 11:05 am
by matthiasone
go ahead and mail them to me........to make sure I get the right ones. I looked at the socket.php and it called pear.php..........do I need that one too?
Matt
Posted: Fri Jul 26, 2002 11:09 am
by llimllib
if you have any pear installed (i assumed you did) then pear.php should be in the pear/ directory.
Also, if i'm gonna email you, I'll need an address.
Posted: Fri Jul 26, 2002 11:10 am
by matthiasone
I don't think I have any pear install if I do I don't know about it
mphillips@lufkin.org
Matt