Alvaro
Alvaro

Reputation: 41605

Warning: mail(mail.log): failed to open stream: Permission denied in

I am trying to use the function mail in a server over windows with iss7 and i am getting this warning which doesn't let me send mails:

Warning: mail(mail.log): failed to open stream: Permission denied in xxxx 

That line is:

mail("[email protected]", "subject", 'body',"From: [email protected]")

At php.ini i have configured SMTP server, port and sendmail_from like this:

; http://php.net/smtp
SMTP = 128.x.x.xxx
; http://php.net/smtp-port
smtp_port = 110

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = [email protected]

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
mail.log = mail.log

I have also created a file called "mail.log" inside C:/php/ and i have changed permissions to write and read for all users.

Also, at phpinfo() safe_mode is Off.

I am currently sending mails with PHPMailer but it is soooo slow that i want to try it with mail function.

Do you know what am I doing wrong? Thanks.

Upvotes: 2

Views: 8845

Answers (1)

janosrusiczki
janosrusiczki

Reputation: 1931

You should have a mail.log entry in your php.ini file which should log all the mail() function calls. Search for it and if you don't have this line, then it's taking some strange default or previously defined value, so you better define it and point it to the file you have created in your PHP folder and hopefully assigned good permissions to. For more check what phpinfo() is saying about mail.log.

For more info: mail configuration.

Upvotes: 2

Related Questions