Hoi,
ik heb de tutorial en posts daarover wat uitgeprobeerd, en alles lijkt ok te gaan. Maar nu doet sendmail niets meer...
ik had een gmail notification gezonden naar een onbestaand
adres@scoutsaleydis.be, wetende dat het bij mij zou komen. Niet dus.
De log ziet er zo uit:
Code:
procmail: Assigning "DEFAULT=/scoutnet.be/users/scoutsaleydis/mail/Inbox"
procmail: Executing "/usr/local/bin/php,-q,/scoutnet.be/users/scoutsaleydis/mail.php"
procmail: Assigning "LASTFOLDER=/usr/local/bin/php -q /scoutnet.be/users/scoutsaleydis/mail.php"
procmail: Assigning "LASTFOLDER=/usr/sbin/sendmail -oi mabogie@gmail.com"
procmail: Executing "/usr/sbin/sendmail,-oi,mabogie@gmail.com"
procmail: Notified comsat: "sn1092@:/usr/sbin/sendmail -oi mabogie@gmail.com"
From mabogie@gmail.com Thu Aug 24 17:55:19 2006
Subject: test
Folder: /usr/sbin/sendmail -oi mabogie@gmail.com 1687
en mijn .procmailrc :
Code:
VERBOSE=on
MAILDIR=$HOME/mail
PMDIR=$HOME/.procmail
LOGFILE=$PMDIR/log
DEFAULT=$MAILDIR/Inbox
# INCLUDERC=$PMDIR/test.rc
:0 c
| /usr/local/bin/php -q $HOME/mail.php
:0 a
! mabogie@gmail.com
Ook worden de bestanden niet opgeslagen in de /inbox.
mail.php ziet er als volgt uit:
Code:
#!/usr/local/bin/php
<?php
//connect met de database
$hostname_db = "localhost";
$username_db = "{login}";
$password_db = "{paswoordhier}";
$link=MYSQL_CONNECT($hostname_db, $username_db, $password_db) OR DIE("Unable to connect");
@MYSQL_SELECT_DB("sn1092_site",$link) OR DIE("Unable to select database");
$password_db = "nietsmeer";
// read from stdin
$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)) {
$email .= fread($fd, 1024);
}
fclose($fd);
// handle email
$lines = explode("\n", $email);
// empty vars
$from = "";
$subject = "";
$headers = "";
$message = "";
$splittingheaders = true;
for ($i=0; $i<count($lines); $i++) {
if ($splittingheaders) {
// this is a header
$headers .= $lines[$i]."\n";
// look out for special headers
if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) {
$subject = $matches[1];
}
if (preg_match("/^From: (.*)/", $lines[$i], $matches)) {
$from = $matches[1];
}
} else {
// not a header, but message
$message .= $lines[$i]."\n";
}
if (trim($lines[$i])=="") {
// empty line, header section has ended
$splittingheaders = false;
}
}
$sql = "INSERT INTO mailing (inhoud) VALUES ('".$message."')";
$result = mysql_query($sql);
Zo werkt de mail.php wel (de mail wordt wel niet meer geforward)
van zodra ik de sql verander in bv:
INSERT INTO mailing (inhoud, subject, from) VALUES ('".$message."','".$subject."','".$from."') - wat mij juist lijkt, wilt ie het niet meer in de dbase steken, ook al klopt die ook...
Enig idee wat ik allemaal verkeerd doe?