mail() only works when connected to mysql

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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

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

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
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

Re: mail() only works when connected to mysql

Wessman wrote:

Quoted text here. Click to load it

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.


Site Timeline