Elxis CMS Forum

Extensions => Components => Topic started by: forgetms on November 09, 2009, 14:48:58

Title: com_contact does not send mail
Post by: forgetms on November 09, 2009, 14:48:58
Hi!

I installed Elxis 2008.1 with com_contact and postfix in two Debian.  Both boxes property send out mails from /usr/sbin/sendmail command. Postfix logs every message it processed in /var/log/mail.log.

The Site | Global Configuration | Mail on both boxes are exactly the same.  Com_contact propertly sends emails out from the first box.

The second one never does - it silently discards all messages visitors typed in com_contact. Most likely the problem is in com_contact (and its configuration) because /var/log/mail.log is always empty regardless of visitors'  messages sent from com_contact.

I have re-checked everything in the second box I can think of. Will some kind soul help?

TIA

CN
Title: Re: com_contact does not send mail
Post by: xmanhattan on November 09, 2009, 15:42:55
So in other words, you have first checked that you can send email through your debian system using another email program.

What email function from the global configuration mail have you assigned?

If sendmail, then is the path correct the same as in debian?


Title: Re: com_contact does not send mail
Post by: ks-net on November 09, 2009, 16:34:52
Almost answered your question

you have the same com_contact (always is the same) unless you missing files permissions or have made  modification  => check updiag
And ...
different server :o something stings here

so...

/var/log/mail.log ?
try /var/log/messages.log also change postifix debug level
Title: Re: com_contact does not send mail
Post by: forgetms on November 09, 2009, 17:51:57
So in other words, you have first checked that you can send email through your debian system using another email program.
No. I used /usr/sbin/sendmail to send emails and it does the job in both Debian boxes. This sendmail program comes with postfix.
Quote
What email function from the global configuration mail have you assigned?

If sendmail, then is the path correct the same as in debian?
Yes. "Sendmail path" is set to the default path, /usr/sbin/sendmail, in "Site | Global Configuration | Mail".

Regards,
CN
Title: Re: com_contact does not send mail
Post by: forgetms on November 09, 2009, 18:01:14
Almost answered your question

you have the same com_contact (always is the same) unless you missing files permissions or have made  modification  => check updiag
And ...
different server :o something stings here
The way I "installed" Elxis in the second (not working) Debian box is in fact unpacking the whole tarball packed from the first (working) box. These two installations of Elxis should be 100% identical.
Quote
so...

/var/log/mail.log ?
try /var/log/messages.log also change postifix debug level
Nothing and nothing.

Priviliges with sendmail is fine, too:

-rwx-r-xr-x

Now I begin to suspect /usr/sbin/sendmail has never been called by com_contact at all!

Regards,
CN
Title: Re: com_contact does not send mail
Post by: ks-net on November 09, 2009, 18:10:14
Quote
The way I "installed" Elxis in the second (not working) Debian box is in fact unpacking the whole tarball packed from the first (working) box. These two installations of Elxis should be 100% identical.
same paths? what domain? public servers  or localhost?

100% identical says nothing!... checked updiag?
Title: Re: com_contact does not send mail
Post by: forgetms on November 10, 2009, 04:10:55
same paths? what domain? public servers  or localhost?
Yes, both are under the same path:
/var/www/htdocs/

I can't answer the other two questions as I don't get their meanings.  Hmm...Both boxes are connected to Internet. Does this mean they are both "public servers"?
Quote
100% identical says nothing!... checked updiag?
The attached file shows the discrepancies, but I have a feeling that I should keep my files as they are and don't update them blindly.

Perhaps debugging contact.php is my best choice for this moment. Would some guru show me how to embed debug code in contact.php to append string to log file in the file system? For example, I would like to debug this way:
Code: [Select]
$con_id = intval( mosGetParam($_POST ,'con_id', 0 ));
/* Write string "AA" to /tmp/log.txt */

/* SECURITY CHECK */
if ($mainframe->getCfg('captcha')) {
        $code = getEncString(trim( mosGetParam($_POST, 'code', '')));
/* Append string "\nBB" to /tmp/log.txt */
        if ($code != $_SESSION['captcha']) {
elxError(_E_INV_SECCODE, 1);
/* Append string "\nCC" to /tmp/log.txt */
return;
        }
Would some kind soul show me the PHP function that will output the string to a file?

Regards,
CN

[attachment deleted by admin]
Title: Re: com_contact does not send mail
Post by: datahell on November 10, 2009, 13:41:53
Code: (php) [Select]
function elxlogger($data='') {
$logfile = '/absolute/path/to/log/file.txt';
if (!file_exists($logfile)) { return false; }
$dt = date('Y-m-d H:i:s');
$fp = @fopen($logfile, 'w');
if (!$fp) { return false; }
$msg = $dt."\t".$data."\n";
fwrite($fp, $msg);
fclose($fp);
}

Place this function somewhere globbaly accessible (f.e. in includes/Core/loader.php file).
Set the $logfile path properly.

Usage:
elxlogger('data to write');
Title: Re: com_contact does not send mail
Post by: forgetms on November 12, 2009, 09:52:14
The problem has been spotted. Please refer to Subect "Please update this wiki entry" as in

https://forum.elxis.org/index.php?topic=4160.0

Regards,
CN