You are not logged in.

#1 2013-11-07 17:57:14

maxarsys
Member
Registered: 2013-09-01
Posts: 61

howto activate mail() option ? [SOLVED]

Hi!

I just started to run an apache server, with php, and mysql (mariadb), it works great, however the script I used to install a preconfigured blog (SPIP) is warning me about two thing : First the the function date() is not safe and it should be use with a timezone. So I wonder howcan I make php interpret date() function in php code to another function that is safer.

Second thing, I cant use the option mail(), i tryed installing POSTFIX following the wiki but i get stuck. How can I activated the mail function ?

Last edited by maxarsys (2013-11-08 07:36:21)

Offline

#2 2013-11-07 18:19:22

COPE
Member
Registered: 2013-11-03
Posts: 31

Re: howto activate mail() option ? [SOLVED]

maxarsys wrote:

Hi!First the the function date() is not safe and it should be use with a timezone. So I wonder howcan I make php interpret date() function in php code to another function that is safer.

date_default_timezone_set or edit php.ini.

Offline

#3 2013-11-07 19:58:05

maxarsys
Member
Registered: 2013-09-01
Posts: 61

Re: howto activate mail() option ? [SOLVED]

Thanks, it solved it.

Now I decided to install ssmtp to be use for mail() command from php.
I configured everything works properly besides the fact that after I ve used a small script to test the mail() option, it doesnt work.
I get this error in /var/log/httpd/error_log :
sendmail: Cannot open mail:25

I ve read in the wiki that it is due because i have to add the user to the mail group.

Infact I did add root to mail group, and the command :

#mail myacc@gmail.com < testmail.txt

works great(when it was showing the same error"sendmail: Cannot open mail:25" when user root wasnt in mail group.

Now I added http, mysql, php to mail group using the command :

#gpasswd -a username mail

but i still get the error in /var/log/httpd/error_log.

Any suggestions ?


Fixed : I dont how but I was abble abble to send email in the console without the line :

mailhub=smtp.gmail.com:587

in my ssmtp config file and now i can send email with php, I had to add this in php.ini

sendmail_path = /usr/sbin/ssmtp -t

Last edited by maxarsys (2013-11-08 07:35:36)

Offline

Board footer

Powered by FluxBB