Page 1 of 1

Sending mail with mail() function and sendmail (Linux)

Posted: Thu Mar 06, 2008 7:14 am
by Mastropiero
Hi,

I'm trying to send a mail by using the mail() function but it doesn't work :-(

The php.ini is ok (the path to sendmail executable is correct) and the sendmail works fine when executed from command-line.

The mail() function gets an error without actually attempting to invoke the sendmail command (the /var/log/maillog says 'nothing').

I thought it was a permissions issue so I granted execution permission for everyone but it didn't work.

Any idea?

Thanks in advance.

Re: Sending mail with mail() function and sendmail (Linux)

Posted: Thu Mar 06, 2008 8:53 am
by Sekka
Are no errors being displayed for debugging?

Try the following code before the mail() is run, and if a problem occurs, an error should be thrown.

Code: Select all

error_reporting (E_ALL);
ini_set ("display_errors", true);

Re: Sending mail with mail() function and sendmail (Linux)

Posted: Thu Mar 06, 2008 9:15 am
by Mastropiero
Sekka wrote:Are no errors being displayed for debugging?

Try the following code before the mail() is run, and if a problem occurs, an error should be thrown.

Code: Select all

error_reporting (E_ALL);
ini_set ("display_errors", true);
Nothing happens :-(

The mail() result is still "false" (of course the mail is not sent) and no other error is displayed.

:-(

Re: Sending mail with mail() function and sendmail (Linux)

Posted: Thu Mar 06, 2008 9:41 am
by Sekka
Trying using something like PHPMailer or Swift Mailer.

They are pre-built code packages for sending mails, both very good.

PHPMailer using the server's mail() function and SMTP, where as Swift is SMTP only.

Re: Sending mail with mail() function and sendmail (Linux)

Posted: Thu Mar 06, 2008 9:48 am
by Mastropiero
Sekka wrote:Trying using something like PHPMailer or Swift Mailer.

They are pre-built code packages for sending mails, both very good.

PHPMailer using the server's mail() function and SMTP, where as Swift is SMTP only.
Ok. I've installed PHPMailer and it says that fsock is missing. :S

I've installed the php-devel package. Is it enough, or I have to recompile PHP?

Thanks again.