Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #11  
Old 20th January 2010, 20:04
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,034
Thanks: 265
Thanked 151 Times in 131 Posts
Default

Can you also test:
support@hardjob.com: "|/var/www/clients/client0/web1/web/cli/index.php"
or
support@hardjob.com, "|/var/www/clients/client0/web1/web/cli/index.php"
Reply With Quote
Sponsored Links
  #12  
Old 20th January 2010, 20:27
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,034
Thanks: 265
Thanked 151 Times in 131 Posts
Default

Found it I think.

Try:

hardjob.com: "|/var/www/clients/client0/web1/web/cli/index.php"

and than newaliases

Let me know if it worked for you.
Reply With Quote
  #13  
Old 22nd January 2010, 00:10
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,034
Thanks: 265
Thanked 151 Times in 131 Posts
Default

I've done some more testing on my ISPconfig 3 server, and I can for some reason not get it to work.

Let me know if you find a way to make it work.

Again.. Its working great on a ISP2config setup server.
Reply With Quote
  #14  
Old 17th February 2010, 19:45
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

How I got this to work...

Since ISPConfig3 wants me to have a domain name with the email addresses I added a mail forwarding entry of "script@example.com" forwarded to script.

In "/etc/aliases" I added "script: |/var/www/some_directory/email_script.php". Then run "newaliases". Note that the directory is not in a web root of any client.

"email_script.php" contains...
Code:
#!/usr/bin/php
<?php
// 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;
	}
} 

preg_match("/boundary=\".*?\"/i", $headers, $boundary);
$boundaryfulltext = $boundary[0];

if ($boundaryfulltext!="") {
	$find = array("/boundary=\"/i", "/\"/i");
	$boundarytext = preg_replace($find, "", $boundaryfulltext);
	$splitmessage = explode("--" . $boundarytext, $message);
	$fullmessage = ltrim($splitmessage[1]);
	preg_match('/\n\n(.*)/is', $fullmessage, $splitmore);
	if (substr(ltrim($splitmore[0]), 0, 2)=="--") {
		$actualmessage = $splitmore[0];
	} else {
		$actualmessage = ltrim($splitmore[0]);
	}
} else {
	$actualmessage = ltrim($message);
}

$clean = array("/\n--.*/is", "/=3D\n.*/s");
$message = trim(preg_replace($clean, "", $actualmessage)); 

// Everything after here is just for testing...

$from="From: ".$from."\n\n\n";
$subject="Subject: ".$subject."\n\n\n";
$message="Message: ".$message."\n\n\n";
$headers="Headers: ".$headers."\n\n\n";
$email=$from.$subject.$message.$headers;
mail('sombody@somehwhere.net','Script Response', $email);

// Directory must be 777 to write to it...
$myFile = "/var/www/some_directory/email_script_test.txt";
$fh = fopen($myFile, 'w');
fwrite($fh, $email);
fclose($fh);

?>
__________________
System6Hosting.com, ISPConfig 3, Debian.

Last edited by BorderAmigos; 17th February 2010 at 19:48.
Reply With Quote
The Following User Says Thank You to BorderAmigos For This Useful Post:
edge (17th February 2010)
  #15  
Old 17th February 2010, 22:05
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,034
Thanks: 265
Thanked 151 Times in 131 Posts
 
Default

We got it all working.
Have a look here: http://www.howtoforge.com/forums/showthread.php?t=42755

You only need to add some stuff to the "Custom Rules > Custom mail filter recipe"

still thank you for posting the info.
__________________
Never execute code written on a Friday or a Monday.
Reply With Quote
The Following User Says Thank You to edge For This Useful Post:
falko (18th February 2010)
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
freebsd 7, samba 3, domain controller alexdimarco Suggest HOWTO 6 5th November 2010 16:54
Freebsd 6.1 support misterm Installation/Configuration 10 9th April 2009 09:29
network issues now it says "401 The web site is blocked by administrator" Check General 3 26th February 2008 14:22
Slightly Confused (DNS & Server Help) JohnnyBGoode Installation/Configuration 26 14th August 2007 09:54
VirtualHosts marra87 General 9 12th September 2006 04:09


All times are GMT +2. The time now is 03:50.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.