PHP mail not working

Discussion in 'Installation/Configuration' started by gdekeijzer, Jan 31, 2011.

  1. gdekeijzer

    gdekeijzer New Member

    Hi there,

    Fresh install of 3.0.3.2 using the debian guide with postfix and dovecot.
    However, not using this server as mailserver or dns.

    Websites running just fine. However the php mail function does not work.
    I got no errors in my mail.log.

    Anywhere else to start debugging this??

    Regards,

    Gerwin
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Did you install Postfix?
     
  3. gdekeijzer

    gdekeijzer New Member

    Yep. According to page 2 of the perfect setup guide i installed it.

    Code:
    apt-get install postfix postfix-mysql postfix-doc
    I know that this might not be sufficient.
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Can you post the not-working PHP code?
     
  5. gdekeijzer

    gdekeijzer New Member

    Here is the code:

    Code:
    <?
    
    $naam_ontvanger = "Kerkdienst Crew";
    $email_ontvanger = "[email protected]"; 
    $naam_verzender = "ZZBO Roostermelding"; 
    $email_verzender = "[email protected]"; 
    $headers  = 'MIME-Version: 1.0' . "\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
    $headers .= 'From: ZZBO Roostermelder <[email protected]>' . "\n";
    $headers .= "To: [email protected]";
    
      	   
    $subject = "Je hebt dienst aankomend weekend !!";
    $message = "Beste ZZBO-er,
    
    Volgens het rooster heb je aankomend weekend kerkdienst.
    
    sdjflasjdflaksjd
    
    Succes met jullie dienst.
    
    (dit bericht is geautomatiseerd en kan derhalve niet worden beantwoord)";
    							
    $bericht = nl2br($message);
    
    mail($email_ontvanger, $subject, $bericht, $headers);
    
    ?>
    
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Just a guess, can you replace the opening PHP tag
    Code:
    <?
    with
    Code:
    <?php
    ?
     
  7. gdekeijzer

    gdekeijzer New Member

    Nope. Does not work either. Which files do i check for error tracking?

    Btw, do i need to change something in my php.ini to change the php-mail function? f.i. sendmail path (actually using postfix)
     
  8. falko

    falko Super Moderator Howtoforge Staff

    Can you post the mail part of your php.ini? Did you modify it? Normally you don't have to modify it, the mail() function works out of the box.
     

Share This Page