Solved

Sending emails on PHP isn't working correctly (centos)

Posted on 2014-12-21
11
249 Views
Last Modified: 2014-12-21
Hello, I've recently set up a new website http://minecraftcommunity.org/ and everything has worked so far exept the email sending trough php. If you for example try to register http://minecraftcommunity.org/register or contacting http://minecraftcommunity.org/register no emails are being sent away. And I do have configuered the php.ini correctly. So I wonder how to fix this issue.

php.ini
[mail function]
; For Win32 only.
; http://www.php.net/manual/en/mail.configuration.php#ini.smtp
SMTP = localhost
; http://www.php.net/manual/en/mail.configuration.php#ini.smtp-port
smtp_port = 25

; For Win32 only.
; http://www.php.net/manual/en/mail.configuration.php#ini.sendmail-from
sendmail_from = Mail@minecraftcommunity.org

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://www.php.net/manual/en/mail.configuration.php#ini.sendmail-path
sendmail_path = /var/www/mail -t -i

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originaiting-Script: that will include uid of the script followed by the filename
mail.add_x_header = On

; Log all mail() calls including the full path of the script, line #, to address and headers
mail.log = /var/www/error

Open in new window

0
Comment
Question by:johandrex
  • 6
  • 5
11 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40511610
And what is in your error log?
Do you install Postfix?
0
 

Author Comment

by:johandrex
ID: 40511613
Is it required to have postfix when sending mail in php? Because postfix isn't startable for me.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40511615
Whats in the logs?

When you installed Centos did you not install a GUI like ISPConfig?
0
 

Author Comment

by:johandrex
ID: 40511623
--------------------- Postfix Begin ------------------------

        6   *Fatal:   General fatal
 
        2   Postfix start        
 
 
 
 **Unmatched Entries**
        1   Dec 19 20:24:14 ns331757 postfix/postfix-script[1198]: warning: not owned by postfix: /var/lib/postfix/./master.lock
        1   Dec 19 20:24:03 ns331757 postfix/postfix-script[864]: warning: not owned by postfix: /var/lib/postfix/./master.lock
 
 ---------------------- Postfix End -------------------------
0
 

Author Comment

by:johandrex
ID: 40511625
And when trying to send a email with sendmail
   ----- The following addresses had permanent fatal errors -----
<johannes.seldevall@telia.com>
    (reason: 553 <root@email.minecraftcommunity.org> unable to verify address)

   ----- Transcript of session follows -----
... while talking to mail.telia.com.:
>>> MAIL From:<root@email.minecraftcommunity.org> SIZE=781
<<< 553 <root@email.minecraftcommunity.org> unable to verify address
501 5.6.0 Data format error

--sBL9qUwS029173.1419155550/email.minecraftcommunity.org
Content-Type: message/delivery-status

Reporting-MTA: dns; email.minecraftcommunity.org
Received-From-MTA: DNS; email.minecraftcommunity.org
Arrival-Date: Sun, 21 Dec 2014 10:52:30 +0100

Final-Recipient: RFC822; johannes.seldevall@telia.com
Action: failed
Status: 5.1.3
Diagnostic-Code: SMTP; 553 <root@email.minecraftcommunity.org> unable to verify address
Last-Attempt-Date: Sun, 21 Dec 2014 10:52:30 +0100

--sBL9qUwS029173.1419155550/email.minecraftcommunity.org
Content-Type: message/rfc822

Return-Path: <root@email.minecraftcommunity.org>
Received: from email.minecraftcommunity.org (email.minecraftcommunity.org [127.0.0.1])
	by email.minecraftcommunity.org (8.14.4/8.14.4) with ESMTP id sBL9qUwS029171
	for <johannes.seldevall@telia.com>; Sun, 21 Dec 2014 10:52:30 +0100
Received: (from root@localhost)
	by email.minecraftcommunity.org (8.14.4/8.14.4/Submit) id sBL9qUkN029170
	for johannes.seldevall@telia.com; Sun, 21 Dec 2014 10:52:30 +0100
From: root <root@email.minecraftcommunity.org>
Message-Id: <201412210952.sBL9qUkN029170@email.minecraftcommunity.org>
Date: Sun, 21 Dec 2014 10:52:30 +0100
To: johannes.seldevall@telia.com
Subject: testing mail
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

awd
d.

--sBL9qUwS029173.1419155550/email.minecraftcommunity.org--

Open in new window

0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40511626
I meant your mail.log after trying to send an email.

The postfix error is a permissions issue
Try running
chown postfix.postfix -R /var/lib/postfix

Open in new window


And start postfix
0
 

Author Comment

by:johandrex
ID: 40511628
oh wow it worked haha
0
 

Author Comment

by:johandrex
ID: 40511629
I'll set up the postfix and check if it works now, thanks
0
 
LVL 58

Expert Comment

by:Gary
ID: 40511631
Your email is being rejected by the destination server.

In your PHP script specify a valid from address
0
 
LVL 58

Expert Comment

by:Gary
ID: 40511632
Then you can follow the instructions for the email routing in the previous question and your email shouldn't be rejected then.
0
 

Author Comment

by:johandrex
ID: 40511742
Thank you so much dude! Finally it's working!!!
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Fine Tune your automatic Updates for Ubuntu / Debian
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now