PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Mastropiero
Forum Newbie
Posts: 3 Joined: Thu Mar 06, 2008 7:12 am
Post
by Mastropiero » Thu Mar 06, 2008 7:14 am
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.
Sekka
Forum Commoner
Posts: 91 Joined: Mon Feb 18, 2008 10:25 am
Location: Huddersfield, West Yorkshire, UK
Post
by Sekka » Thu Mar 06, 2008 8:53 am
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);
Mastropiero
Forum Newbie
Posts: 3 Joined: Thu Mar 06, 2008 7:12 am
Post
by Mastropiero » Thu Mar 06, 2008 9:15 am
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.
Sekka
Forum Commoner
Posts: 91 Joined: Mon Feb 18, 2008 10:25 am
Location: Huddersfield, West Yorkshire, UK
Post
by Sekka » Thu Mar 06, 2008 9:41 am
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.
Mastropiero
Forum Newbie
Posts: 3 Joined: Thu Mar 06, 2008 7:12 am
Post
by Mastropiero » Thu Mar 06, 2008 9:48 am
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.