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("mail@myserver.com", "subject", 'body',"From: mail2@myserver.com")
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 = mymail@myserver.com
; 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.
You should have a
mail.logentry in yourphp.inifile which should log all themail()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 whatphpinfo()is saying about mail.log.For more info: mail configuration.