[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Re: Re: Changing "Return-Path" in PHPmailfunction - Final posting



le 19.10.2001 0:58, Adrian Boismoreau à aboismoreau@xxxxxxxxxxxxxxx a
écrit :

> 
> ----- Original Message -----
> From: "Marco Baurdoux" <linux@xxxxxxxxxxxxx>
> To: <cobalt-users@xxxxxxxxxxxxxxx>
> Sent: Thursday, October 18, 2001 3:14 PM
> Subject: Re: [cobalt-users] Re: Re: Changing "Return-Path" in
> PHPmailfunction - Final posting
> 
> 
>> le 18.10.2001 15:29, Adrian Boismoreau à aboismoreau@xxxxxxxxxxxxxxx a
>> écrit :
>> 
>>> Well, I've tried that but didn't work for me.
>>> 
>>> Adrián E. Boismoreau
>>> __________________
>>> S K Y  m e d i a
>>> info@xxxxxxxxxxxxxxx
>>> www.skymedia.com.ar
>>> 
>>> ----- Original Message -----
>>> From: "Marco Baurdoux" <linux@xxxxxxxxxxxxx>
>>> To: <cobalt-users@xxxxxxxxxxxxxxx>
>>> Sent: Thursday, October 18, 2001 9:18 AM
>>> Subject: Re: [cobalt-users] Re: Re: Changing "Return-Path" in PHP
>>> mailfunction - Help needed
>>> 
>>> 
>>>> le 18.10.2001 13:38, Adrián Boismoreau à aboismoreau@xxxxxxxxxxxxxxx a
>>>> écrit :
>>>> 
>>>>> Well,
>>>>> As I've tested many coding from php.net and other solutions sugested
>>> here
>>>>> and none of them did work for me, I did the following:
>>>>> 
>>>>> Edited the /etc/mail/sendmail.cf. The header stuff looks like this:
>>>>> 
>>>>> #########################
>>>>> #   Format of headers   #
>>>>> #########################
>>>>> 
>>>>> H?P?Return-Path: <$g>
>>>>> HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
>>>>> $.$?{auth_type}(authenticated)
>>>>> $.by $?{if_name}${if_name}$|$j$. ($v/$Z)$?r with $r$. id $i$?u
>>>>> for $u; $|;
>>>>> $.$b
>>>>> H?D?Resent-Date: $a
>>>>> H?D?Date: $a
>>>>> H?F?Resent-From: $?x$x <$g>$|$g$.
>>>>> H?F?From: $?x$x <$g>$|$g$.
>>>>> H?x?Full-Name: $x
>>>>> # HPosted-Date: $a
>>>>> # H?l?Received-Date: $b
>>>>> H?M?Resent-Message-Id: <$t.$i@$j>
>>>>> H?M?Message-Id: <$t.$i@$j>
>>>>> 
>>>>> 
>>>>> I replaced the 2 first lines for this:
>>>>> 
>>>>> H?P?Return-Path: <admin@xxxxxxxxxx>
>>>>> HReceived: $?sfrom $s $.$?_(admin@xxxxxxxxxx)
>>>>> 
>>>>> And now mail headers sent from every script using sendmail has a
> return
>>> path
>>>>> that's not <httpd>
>>>>> Hope hosts not to filter emails anymore.
>>>>> 
>>>>> Regards,
>>>>> 
>>>>> Adrián E. Boismoreau
>>>> 
>>>> 
>>>> Nice starting point, but wouldn't it be better to set the return path
> to
>>> be
>>>> the same as the "from" header ???
>>>> 
>> 
>> OK well here's the answer to this PHP problem.
>> Do not touch the sendmail config file.
>> within your httpd.conf file you can add this to every virtualhost section
>> php_admin_value sendmail_path  " /usr/sbin/sendmail -t -i
>> -fcatchall@xxxxxxxxxxxx"
>> 
>> This will solve the return path problem for all the PHP users.
>> 
> 
> Well.... thank you very much my friend. That solved the Return-Path issue
> for me, and didn't have to modify every script :)
> 

Now for future installations you might want this to be automised:
Edit the /usr/lib/perl5/site_perl/5.005/Cobalt/Vsite.pm module
Scroll down until the vsite_add function ( sub ):

Replace these lines :
my ($addr,$name,$group,$serveradmin,$mask) = @_;
my($found_interface,$found_namev,$conf,$new_conf,$found_group);
my $ret;


with these lines :
my ($addr,$name,$group,$serveradmin,$mask) = @_;
my $emaildomain = substr($name,4,length($name));
my($found_interface,$found_namev,$conf,$new_conf,$found_group);
my $ret;


And then these lines:
<VirtualHost $addr>
ServerName $name
ServerAdmin $serveradmin
CustomLog $Htgroup_dir/$group/$Logdir/webnew.log combined
Alias /stats $Htgroup_dir/$group/stats
DocumentRoot $Htgroup_dir/$group/$Webdir
RewriteEngine on
RewriteCond %{HTTP_HOST}                !^$addr(:80)?$my
RewriteCond %{HTTP_HOST}                !^$name(:80)?$my
RewriteRule ^/(.*)                      http://$name/\$1 [L,R]
RewriteOptions inherit
AliasMatch ^/~([^/]+)(/(.*))? $Htgroup_dir/$group/users/\$1/web/\$3
AliasMatch ^/users/([^/]+)(/(.*))? $Htgroup_dir/$group/users/\$1/web/\$3
</VirtualHost>



with these lines:
<VirtualHost $addr>
ServerName $name
ServerAdmin $serveradmin
CustomLog $Htgroup_dir/$group/$Logdir/webnew.log combined
Alias /stats $Htgroup_dir/$group/stats
DocumentRoot $Htgroup_dir/$group/$Webdir
RewriteEngine on
RewriteCond %{HTTP_HOST}                !^$addr(:80)?$my
RewriteCond %{HTTP_HOST}                !^$name(:80)?$my
RewriteRule ^/(.*)                      http://$name/\$1 [L,R]
RewriteOptions inherit
AliasMatch ^/~([^/]+)(/(.*))? $Htgroup_dir/$group/users/\$1/web/\$3
AliasMatch ^/users/([^/]+)(/(.*))? $Htgroup_dir/$group/users/\$1/web/\$3
php_admin_value upload_tmp_dir $Htgroup_dir/$group
php_admin_value open_basedir $Htgroup_dir/$group:/tmp
php_admin_value sendmail_path  " /usr/sbin/sendmail -t
-i-fcatchall\@$emaildomain"
</VirtualHost>

The sendmail_path line has to be on one line off course !!


Now for some explanations,
The first extra php_admin_value, sets the upload directory to be the root of
the website. No more /tmp filling up.

The second extra php_admin_value, stops php from accessing file outside of
the websites folder.

The third extra php_admin_value will set a default return path, within all
mails sent  via the mail() function of PHP, it will still allow you to
specifiy the other headers such as From, Reply-to etc via this function


These cobalt boxes are very nice, and with some Linux knowledge, you can
make them even better :-))

People don't always believe what Cobalt says, because if you scroll through
the Vsite perl module of a RaQ3, you'll find out that it contains functions
such as:
vsite_get_php3
vsite_set_php3

And this althought these boxes are sold without PHP :-))


Hope this helps.