mail() only works when connected to mysql

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wessman

    #1

    mail() only works when connected to mysql


    sending mail using function mail() only works when I'm connected to
    mysql.

    <?
    mail($to, $subject, "before mysql_connect() ", "From: $from");
    mysql_connect(" localhost", $username, $password);
    mail($to, $subject, "after mysql_connect() ", "From: $from");
    ?>

    The above code results in a single e-mail containing "after
    mysql_connect() ".

    I don't have a clue of what could be wrong or where to start looking.
    I've upgraded the OS, but it didn't help.

    Can someone help me figure out what might be wrong?

    My setup:
    FreeBSD 6.1-RELEASE-p2
    Apache/1.3.35
    4.1.18-log
    PHP 4.4.2

    './configure' '--with-apache=../apache_1.3.35' '--with-openssl'
    '--with-gd' '--with-mysql' '--enable-trans-sid' '--enable-track-vars'
    '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib=/usr'
    '--enable-mbstring' '--enable-ftp' '--enable-exif'
    '--with-freetype-dir=/usr/local' '--with-pspell=/usr/local'

    php ini
    sendmail_path /usr/sbin/sendmail -t -i
    SMTP localhost
    smtp_port 25

  • flamer die.spam@hotmail.com

    #2
    Re: mail() only works when connected to mysql


    Wessman wrote:
    sending mail using function mail() only works when I'm connected to
    mysql.
    >
    <?
    mail($to, $subject, "before mysql_connect() ", "From: $from");
    mysql_connect(" localhost", $username, $password);
    mail($to, $subject, "after mysql_connect() ", "From: $from");
    ?>
    >
    The above code results in a single e-mail containing "after
    mysql_connect() ".
    >
    I don't have a clue of what could be wrong or where to start looking.
    I've upgraded the OS, but it didn't help.
    >
    Can someone help me figure out what might be wrong?
    >
    My setup:
    FreeBSD 6.1-RELEASE-p2
    Apache/1.3.35
    4.1.18-log
    PHP 4.4.2
    >
    './configure' '--with-apache=../apache_1.3.35' '--with-openssl'
    '--with-gd' '--with-mysql' '--enable-trans-sid' '--enable-track-vars'
    '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib=/usr'
    '--enable-mbstring' '--enable-ftp' '--enable-exif'
    '--with-freetype-dir=/usr/local' '--with-pspell=/usr/local'
    >
    php ini
    sendmail_path /usr/sbin/sendmail -t -i
    SMTP localhost
    smtp_port 25
    Does your smtp server require outgoing authentication, possibly the
    mail is failing because no creditentials were supplied and after you've
    connected to mysql its using the same creditentials as specified for
    that. either way.. check your syslog for error messages it should tell
    you exactly what the issue was.

    Flamer.

    Comment

    Working...