How can I use PHP Mail() function within PHP-FPM? On Nginx?
        Posted  
        
            by 
                TheBlackBenzKid
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by TheBlackBenzKid
        
        
        
        Published on 2012-11-02T10:29:06Z
        Indexed on 
            2012/11/02
            11:00 UTC
        
        
        Read the original article
        Hit count: 428
        
I have searched everywhere for this and I really want to resolve this. In the past I just end up using an SMTP service like SendGrid for PHP and a mailing plugin like SwiftMailer. However I want to use PHP.
Basically my setup (I am new to server setup, and this is my personal setup following a tutorial)
Nginx
Rackspace Cloud
PHP 5.3 PHP-FPM
Ubuntu 11.04
My phpinfo() returns this about the Mail entries:
mail.log                     no value
mail.add_x_header            On
mail.force_extra_parameters  no value
sendmail_from   no value
sendmail_path   /usr/sbin/sendmail -t -i
SMTP        localhost
smtp_port   25
Can someone help me to as why Mail() will not work - my script is working on all other sites, it is a normal mail command. Do I need to setup logs or enable some PHP port on the server?
My Sample script
<?
    # FORMS VARS
    // $to = $customers_email;
    // $to = $customers_email;
    $to = $_GET["customerEmailFromForm"];
    $subject = "Thank you for contacting Real-Domain.com";
    $message = "
    <html>
    <head>
    </head>
    <body>
    Thanks, your message was sent and our team will be in touch shortly.
    <img src='http://cdn.com/emails/thank_you.jpg' />
    </body>
    </html>
    ";
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
    $headers .= 'From: <[email protected]>' . "\r\n";
    // SEND MAIL
    mail($to,$subject,$message,$headers);
?>
Thanks
© Stack Overflow or respective owner