MRatWork Forum by Mustafa Ramadhan

Sawo Project - Kloxo-MR Discussions => Kloxo-MR Technical Helps => Topic started by: Vikalp_C on 2017-01-17, 21:47:49

Title: Unable to send mail by PHP mail() function
Post by: Vikalp_C on 2017-01-17, 21:47:49
Hello, I need help in sending mail by php mail() function, which is used in mail forms in 4 of my websites.
When visitor send a message I never receive them. Qmail is configured properly(I think so)
Here is the sysinfo -
Code: [Select]
[root@server bin]# sh /script/sysinfo

A. Kloxo-MR: 6.5.0.f-2016111301

B. OS: CentOS release 6.8 (Final) x86_64

C. Apps:
   1. MySQL: mysql55-5.5.53-1.ius.el6.x86_64
   2. PHP: php54-5.4.45-1.ius.centos6.x86_64
   3. Httpd: httpd-2.2.31-1.mr.el6.x86_64
   4. Lighttpd: --uninstalled--
   5. Nginx: --uninstalled--
   6. Qmail: qmail-toaster-1.03-1.3.55.mr.el6.x86_64
      - with: courier-imap-toaster-4.1.2-1.3.20.mr.el6.x86_64
   7. Dns: bind-9.9.7-1.mr.el6.x86_64

D. Php-type (for Httpd/proxy): mod_php_ruid2

E. Memory:
                total       used       free     shared    buffers     cached
   Mem:          4024        486       3537          6          0        239
   -/+ buffers/cache:        246       3777
   Swap:         4060         62       3997


Also checking in /var/logs/maillogs, I see this error -
Code: [Select]
Jan 18 01:35:50 server root: sendmail: CALLER="/usr/sbin/httpd" PWD="/home/trophy/trophy.com" BAN="no"
Jan 18 01:35:50 server send: new msg 110234671
Jan 18 01:35:50 server send: info msg 110234671: bytes 387 from <anonymous@webmail.vikalp.pro> qp 3168 uid 7802
Jan 18 01:35:50 server send: starting delivery 4: msg 110234671 to local laps.in-principal@laps.in
Jan 18 01:35:50 server send: status: local 1/10 remote 0/60
Jan 18 01:35:50 server send: delivery 4: deferral: /bin/sh:_/home/vpopmail/bin/vdelivermail:_Permission_denied/
Jan 18 01:35:50 server send: status: local 0/10 remote 0/60

Any help will be most appreciated.

Many thanks/
Title: Re: Unable to send mail by PHP mail() function
Post by: MRatWork on 2017-01-18, 02:09:52
Try 'sh /script/fix-chownchmod; sh /script/fixmail-all'.
Title: Re: Unable to send mail by PHP mail() function
Post by: Vikalp_C on 2017-01-18, 09:56:10
Try 'sh /script/fix-chownchmod; sh /script/fixmail-all'.
Done as instructed. Not getting that previous error this time but mail is not getting delivered either.
Getting this in /var/log/maillogs -

Code: [Select]
Jan 18 14:14:43 server root: sendmail: CALLER="/usr/sbin/httpd" PWD="/home/trophy/trophy.com" BAN="no"
Jan 18 14:14:43 server send: new msg 110235503
Jan 18 14:14:43 server send: info msg 110235503: bytes 385 from <anonymous@webmail.vikalp.pro> qp 19720 uid 7802
Jan 18 14:14:43 server send: starting delivery 3: msg 110235503 to remote vikalp.ch@gmail.com
Jan 18 14:14:43 server send: status: local 0/10 remote 1/60
Jan 18 14:14:44 server send: delivery 3: success: User_and_password_not_set,_continuing_without_authentication./<vikalp.ch@gmail.com>_173.194.64.27_accepted_message.Remote_host_said:_250_2.0.0_OK_1484729520_v25si11131937otf.28_-_gsmtp/
Jan 18 14:14:44 server send: status: local 0/10 remote 0/60
Jan 18 14:14:44 server send: end msg 110235503

But still not receiving the mail.

Also, my domain registrar has provided me 2 free email accounts and unlimited email forwards, I am using my domain registrar control panel to manage, create and forward emails to my gmail account. Have not created any mail accounts inside Kloxo-MR(if this is of any help)

If I send the mail using Gmail or any other account the mail is getting delivered to my domain email (mail@domain.com) and getting forwarded to GMail too successfully. But if someone sends using the contact form in website(mail() function), mail is not delivered. :(

Any setting need to be adjusted inside php.ini or something?

Thanks.
Title: Re: Unable to send mail by PHP mail() function
Post by: MRatWork on 2017-01-18, 11:08:55
In many situation, this issue related to 'wrong' hostname and not enable spf in dns.

Inform here your 'hostname; hostname -s'.
Title: Re: Unable to send mail by PHP mail() function
Post by: Vikalp_C on 2017-01-18, 12:24:56
In many situation, this issue related to 'wrong' hostname and not enable spf in dns.

Inform here your 'hostname; hostname -s'.

Here is the output:
Code: [Select]
hostname: server.vikalp.pro
Code: [Select]
hostname -s: server
I am using DNS templates as provided by my Domain registrars. Don't know where the mail is getting lost.
Title: Re: Unable to send mail by PHP mail() function
Post by: MRatWork on 2017-01-18, 14:50:34
Check your domain to mxtoolbox.com
Title: Re: Unable to send mail by PHP mail() function
Post by: Vikalp_C on 2017-01-18, 15:17:11
Check your domain to mxtoolbox.com

Had 1 error.
Code: [Select]
DMARC record missing
How to obtain the DMARC info and where should I add the DMARC record? In Kloxo-MR DNS template or in the domain registrar control panel?

Thanks.
Title: Re: Unable to send mail by PHP mail() function
Post by: MRatWork on 2017-01-18, 16:05:03
DMARC setting not exist in Kloxo-MR 6.5.

BTW, did your domain used external mail server (like google apps)?. If yes, you need setting 'Remote mail' for this domain.
Title: Re: Unable to send mail by PHP mail() function
Post by: Vikalp_C on 2017-01-18, 19:51:36
DMARC setting not exist in Kloxo-MR 6.5.

BTW, did your domain used external mail server (like google apps)?. If yes, you need setting 'Remote mail' for this domain.

No, I am not using any external mail server. Just using the 2 free email accounts and rest email forwarders provided by my domain registrar.