Find the answer to your Linux question:
Results 1 to 2 of 2
I have apache + php and other things configured and working on my server. However when I try to send mail with mail() function like this: Code: <? if(mail("ankhmor@mail.ru", "test", ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Posts
    3

    php mail() doesn't do anything


    I have apache + php and other things configured and working on my server. However when I try to send mail with mail() function like this:

    Code:
    <?
    if(mail("ankhmor@mail.ru", "test", "just testing")){
    echo "done";
    }else{
    echo "something wrong";
    }
    ?>
    the server says

    Code:
    Fatal error: Call to undefined function: mail() in /usr/local/apache2/htdocs/testmail.php on line 2

    and to make thing more clear for you guys Ill give you an excerpt of my php.ini:

    Code:
    [mail function]
    ; For Win32 only.
    ;SMTP = smtp.gmail.com
    ;smtp_port = 25
    
    ; For Win32 only.
    ;sendmail_from = me@example.com
    
    ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
    sendmail_path = /usr/sbin/sendmail -t
    whats wrong?

  2. #2
    Just Joined!
    Join Date
    Jul 2007
    Posts
    3

    was finally able to ...

    Finally, I was able to install sendmail and php works with it. However, sendmail doesn't send anything at all. I didn't configure it, maybe thats why. When I try to send mail from a web page it says everything is ok. But the mail never arrives.

    I opened my port 25 on my router. I acepted protocols in my guarddog (POP3, POPs3, IMAP, IMAPs, and something else I think).

    And to make things clear this is from my mail.log after i send myself an e-mail. If you look at line two it seems that the server send mail only locally.

    oh and my e-mail is antonkats@gmail.com

    Code:
    Jul 11 13:36:15 localhost sendmail[12719]: l6BHaFLF012719: from=root, size=131, class=0, nrcpts=1, msgid=<200707111736.l6BHaFLF012719@localhost.localdomain>, relay=root@localhost
    Jul 11 13:36:15 localhost sm-mta[12722]: l6BHaF2c012722: <antonkats.com@localhost.localdomain>... User unknown
    Jul 11 13:36:15 localhost sendmail[12719]: l6BHaFLF012719: to=antonkats.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30131, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
    Jul 11 13:36:15 localhost sm-mta[12722]: l6BHaF2c012722: from=<root@localhost.localdomain>, size=131, class=0, nrcpts=0, proto=ESMTP, daemon=MSP-v4, relay=localhost.localdomain [127.0.0.1]
    Jul 11 13:36:15 localhost sendmail[12719]: l6BHaFLF012719: l6BHaFLG012719: DSN: User unknown
    Jul 11 13:36:15 localhost sm-mta[12722]: l6BHaF2e012722: from=<>, size=2111, class=0, nrcpts=1, msgid=<200707111736.l6BHaFLG012719@localhost.localdomain>, proto=ESMTP, daemon=MSP-v4, relay=localhost.localdomain [127.0.0.1]
    Jul 11 13:36:15 localhost sendmail[12719]: l6BHaFLG012719: to=root, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31155, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (l6BHaF2e012722 Message accepted for delivery)
    Jul 11 13:36:15 localhost procmail[12727]: Enforcing stricter permissions on "/var/mail/root"
    Jul 11 13:36:15 localhost sm-mta[12726]: l6BHaF2e012722: to=<root@localhost.localdomain>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=32356, dsn=2.0.0, stat=Sent

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •