Learn about Centmin Mod LEMP Stack today
Become a Member

DNS Email Server not sending mail

Discussion in 'Domains, DNS, Email & SSL Certificates' started by Itworx4me, Mar 21, 2017.

  1. Itworx4me

    Itworx4me Member

    220
    21
    18
    Mar 14, 2017
    Ratings:
    +35
    Local Time:
    1:55 PM
    Nginx 1.17.X
    MariaDB 10.3.X
    I still haven't had any luck fixing the email from server issue. I changed the phpini file to /user/bin/sendmail

    I now get this error message after sending an email using the contact us form on Xenforo.
    Code:
    Swift_TransportException: Email to webmaster@domain.com failed: Unsupported sendmail command flags [/usr/sbin/sendmail]. Must be one of "-bs" or "-t" but can include additional flags. src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php:146
    Generated by: Webmaster Mar 24, 2017 at 9:38 PM
    Stack trace
    #0 /home/nginx/domains/domain.com/public/src/XF/Mail/Mailer.php(293): Swift_Transport_SendmailTransport->send(Object(Swift_Message), Array)
    #1 /home/nginx/domains/domain.com/public/src/XF/Mail/Mail.php(259): XF\Mail\Mailer->send(Object(Swift_Message), Object(Swift_SendmailTransport))
    #2 /home/nginx/domains/domain.com/public/src/XF/Service/Contact.php(136): XF\Mail\Mail->send()
    #3 /home/nginx/domains/domain.com/public/src/XF/Pub/Controller/Misc.php(71): XF\Service\Contact->send()
    #4 /home/nginx/domains/domain.com/public/src/XF/Mvc/Dispatcher.php(232): XF\Pub\Controller\Misc->actionContact(Object(XF\Mvc\ParameterBag))
    #5 /home/nginx/domains/domain.com/public/src/XF/Mvc/Dispatcher.php(85): XF\Mvc\Dispatcher->dispatchClass('XF:Misc', 'Contact', 'json', Object(XF\Mvc\ParameterBag), '')
    #6 /home/nginx/domains/domain.com/public/src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
    #7 /home/nginx/domains/domain.com/public/src/XF/App.php(1589): XF\Mvc\Dispatcher->run()
    #8 /home/nginx/domains/domain.com/public/src/XF.php(326): XF\App->run()
    #9 /home/nginx/domains/domain.com/public/index.php(13): XF::runApp('XF\\Pub\\App')
    #10 {main}
    Request state
    array(3) {
      ["url"] => string(23) "/index.php?misc/contact"
      ["_GET"] => array(1) {
        ["misc/contact"] => string(0) ""
      }
      ["_POST"] => array(7) {
        ["subject"] => string(15) "Testing Testing"
        ["message"] => string(15) "Testing Testing"
        ["_xfRedirect"] => string(35) "http://www.domain.com/index.php"
        ["_xfToken"] => string(8) "********"
        ["_xfRequestUri"] => string(10) "/index.php"
        ["_xfWithData"] => string(1) "1"
        ["_xfResponseType"] => string(4) "json"
      }
    }
    Any help would be appreciated
    Itworx4me
     
  2. eva2000

    eva2000 Administrator Staff Member

    44,744
    10,201
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,810
    Local Time:
    6:55 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
  3. Itworx4me

    Itworx4me Member

    220
    21
    18
    Mar 14, 2017
    Ratings:
    +35
    Local Time:
    1:55 PM
    Nginx 1.17.X
    MariaDB 10.3.X
    I have done each step in your link. I reverted the line I uncommented in php.ini. I still get this error:
    Code:
    Server error log
    Swift_TransportException: Email to webmaster@domainname.com failed: Unsupported sendmail command flags [/usr/sbin/sendmail]. Must be one of "-bs" or "-t" but can include additional flags. src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php:146
    Generated by: Webmaster Mar 25, 2017 at 9:04 PM
    Stack trace
    #0 /home/nginx/domains/domainname.com/public/src/XF/Mail/Mailer.php(293): Swift_Transport_SendmailTransport->send(Object(Swift_Message), Array)
    #1 /home/nginx/domains/domainname.com/public/src/XF/Mail/Mail.php(259): XF\Mail\Mailer->send(Object(Swift_Message), Object(Swift_SendmailTransport))
    #2 /home/nginx/domains/domainname.com/public/src/XF/Service/Contact.php(136): XF\Mail\Mail->send()
    #3 /home/nginx/domains/domainname.com/public/src/XF/Pub/Controller/Misc.php(71): XF\Service\Contact->send()
    #4 /home/nginx/domains/domainname.com/public/src/XF/Mvc/Dispatcher.php(232): XF\Pub\Controller\Misc->actionContact(Object(XF\Mvc\ParameterBag))
    #5 /home/nginx/domains/domainname.com/public/src/XF/Mvc/Dispatcher.php(85): XF\Mvc\Dispatcher->dispatchClass('XF:Misc', 'Contact', 'json', Object(XF\Mvc\ParameterBag), '')
    #6 /home/nginx/domains/domainname.com/public/src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
    #7 /home/nginx/domains/domainname.com/public/src/XF/App.php(1589): XF\Mvc\Dispatcher->run()
    #8 /home/nginx/domains/domainname.com/public/src/XF.php(326): XF\App->run()
    #9 /home/nginx/domains/domainname.com/public/index.php(13): XF::runApp('XF\\Pub\\App')
    #10 {main}
    Request state
    array(3) {
      ["url"] => string(23) "/index.php?misc/contact"
      ["_GET"] => array(1) {
        ["misc/contact"] => string(0) ""
      }
      ["_POST"] => array(7) {
        ["subject"] => string(48) "Will Hanna launches new website InsideProMod.com"
        ["message"] => string(48) "Will Hanna launches new website InsideProMod.com"
        ["_xfRedirect"] => string(35) "http://www.domainname.com/index.php"
        ["_xfToken"] => string(8) "********"
        ["_xfRequestUri"] => string(10) "/index.php"
        ["_xfWithData"] => string(1) "1"
        ["_xfResponseType"] => string(4) "json"
      }
    }
    I am at such a loss as to why this still doesn't work...

    Itworx4me
     
  4. eva2000

    eva2000 Administrator Staff Member

    44,744
    10,201
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,810
    Local Time:
    6:55 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    still using sendmail, did you restart php-fpm after reverting php.ini changes ?
     
  5. Itworx4me

    Itworx4me Member

    220
    21
    18
    Mar 14, 2017
    Ratings:
    +35
    Local Time:
    1:55 PM
    Nginx 1.17.X
    MariaDB 10.3.X
    That was by bad for not restarting php. I have restarted php. Still no email sent though using the contact us link.

    Thanks,
    Itworx4me
     
  6. eva2000

    eva2000 Administrator Staff Member

    44,744
    10,201
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,810
    Local Time:
    6:55 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
  7. Itworx4me

    Itworx4me Member

    220
    21
    18
    Mar 14, 2017
    Ratings:
    +35
    Local Time:
    1:55 PM
    Nginx 1.17.X
    MariaDB 10.3.X
    I followed all your steps. Still won't send email through contact us link. I scored 9out10 mail-tester.com site. I thought I remember reading that xenforo send emails out using php something... Any other ideas?

    Itworx4me
     
  8. eva2000

    eva2000 Administrator Staff Member

    44,744
    10,201
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,810
    Local Time:
    6:55 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    what have you set for xenforo > options > emails Email | XenForo

    • is 'Sender info in From header on contact emails' checked or unchecked ?
    • is 'Set return path with -f parameter (recommended, but does not work on all servers)' checked or unchecked ?
    also check Email Troubleshooting Guide

    also use mail-tester.com with PHP mail() function test

    To Test PHP mail() Sent Email

    To test PHP mail() function sent email, create a test-mail.php file (can be any name you want) with contents - changing the web-1a0xv@mail-tester.com to whatever you see on mail-tester.com web site
    PHP:
    <?php
        ini_set
    ('display_errors'1);
        
    error_reporting(-1);
        
    mail ('web-1a0xv@mail-tester.com''Postfix Test''A test email') || print_r(error_get_last());
    ?>
    save test-mail.php to /home/nginx/domains/domain.com/public/ web root directory and then open up domain.com/test-mail.php on your server. Remember to delete test-mail.php afterwards.

    Then click the 'then check your score' button on mail-tester.com site. It will check the email you sent and all it's email headers and give you a report card for the sending domain which is usually your main hostname in default Centmin Mod setups i.e. if sending email is root@hostname.domain.com, then sending domain is hostname.domain.com. You can ignore for subdomains the warning of no MX records for subdomain/hostnames as subdomain/hostnames don't require MX records only the @domain.com domain for receiving emails.

    This checks php mail() from server sent From = root@host.domain.com where host.domain.com is your main hostname. To test php mail() with a proper From = your@domain.com which maybe set in your PHP web app like Xenforo, Wordpress etc. Use a slight variation of the test-mail.php php file below - changing the web-1a0xv@mail-tester.com to whatever you see on mail-tester.com web site and changing YOURFROM@domain.com email address to the one you set in your PHP web app like Xenforo, Wordpress etc:
    PHP:
    <?php
        ini_set
    ('display_errors'1);
        
    error_reporting(-1);
       
    $headers "From: YOURFROM@domain.com";
        
    mail ('web-1a0xv@mail-tester.com''Postfix Test''A test email',$headers) || print_r(error_get_last());
    ?>
    then open up domain.com/test-mail.php on your server. Then click the 'then check your score' button on mail-tester.com site
     
    Last edited: Mar 26, 2017
  9. Itworx4me

    Itworx4me Member

    220
    21
    18
    Mar 14, 2017
    Ratings:
    +35
    Local Time:
    1:55 PM
    Nginx 1.17.X
    MariaDB 10.3.X
    Ok I haven't been able to work on theses issues due to health reason. But I am back at it now. Here are my results. Spam Test Result

    I have fixed my the spf record. I don't know whats wrong with the dkim record. I also don't know what is wrong with the mx record as I use google apps for this application which returns the correct mx record but not on this test... :( Any other helpful pointers will be appreciated.

    Itworx4me
     
  10. eva2000

    eva2000 Administrator Staff Member

    44,744
    10,201
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,810
    Local Time:
    6:55 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    MX is for @domain.com for Google App not @host.domain.com so that is normal as you are testing @host.domain.com not @domain.com

    As to DKIM, need to confirm it's set correctly as outlined in this thread. You can try resetting a new DKIM signature as per post #11 and update DNS with new DKIM txt file
     
  11. Itworx4me

    Itworx4me Member

    220
    21
    18
    Mar 14, 2017
    Ratings:
    +35
    Local Time:
    1:55 PM
    Nginx 1.17.X
    MariaDB 10.3.X
    I just did another test and here are the results: Spam Test Result

    It says that I don't have an mx record for my
    firegrilled.food-karts.com. Do I need to set that up in order for this to work correctly?

    Thanks,
    Itworx4me
     
  12. eva2000

    eva2000 Administrator Staff Member

    44,744
    10,201
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,810
    Local Time:
    6:55 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x