Question about mail()
Moderator: General Moderators
-
matthiasone
- Forum Contributor
- Posts: 117
- Joined: Mon Jul 22, 2002 12:14 pm
- Location: Texas, USA
- Contact:
Question about mail()
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
--------------------------------------------------------------------------------
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
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.
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.
-
matthiasone
- Forum Contributor
- Posts: 117
- Joined: Mon Jul 22, 2002 12:14 pm
- Location: Texas, USA
- Contact:
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
matthiasone
- Forum Contributor
- Posts: 117
- Joined: Mon Jul 22, 2002 12:14 pm
- Location: Texas, USA
- Contact:
-
matthiasone
- Forum Contributor
- Posts: 117
- Joined: Mon Jul 22, 2002 12:14 pm
- Location: Texas, USA
- Contact:
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.
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.
-
matthiasone
- Forum Contributor
- Posts: 117
- Joined: Mon Jul 22, 2002 12:14 pm
- Location: Texas, USA
- Contact:
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
How does that PEAR::SMTP work..........we have a mail server (Exchange) on a different server
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:
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.
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);
?>-
matthiasone
- Forum Contributor
- Posts: 117
- Joined: Mon Jul 22, 2002 12:14 pm
- Location: Texas, USA
- Contact:
-
matthiasone
- Forum Contributor
- Posts: 117
- Joined: Mon Jul 22, 2002 12:14 pm
- Location: Texas, USA
- Contact: