#1  
Old 30th June 2007, 15:09
Mr Blek Mr Blek is offline
Junior Member
 
Join Date: Jun 2006
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
Default Bounced email

Any bounced email returns to wwwrun@hostname.domain.com for all the hosted sites. How can I change it so it returns back to the originator?

In VBulletin I can do this by using SMTP for sending emails. The problem seems to be with those sites using the php mail function.

Using SMTP:

Code:
Return-Path: <webmaster@hostedsite.com>
Using php mail:

Code:
Return-Path: <wwwrun@hostname.domain.com>
Reply With Quote
Sponsored Links
  #2  
Old 30th June 2007, 17:42
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,419
Thanks: 812
Thanked 5,205 Times in 4,081 Posts
Default

The PHP scripts must set the correct from and return-path parameters in the php mail function as additional headers:

http://www.php.net/manual/en/function.mail.php
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 1st July 2007, 16:33
Mr Blek Mr Blek is offline
Junior Member
 
Join Date: Jun 2006
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
Default

If I do it from VBulletin I need to send the -f parameter to sendmail.

On the VBulletin diagnostic page it says

Quote:
Pertinent PHP Settings
SMTP: localhost
sendmail_from: None
sendmail_path: /usr/sbin/sendmail -t -i

Results
The mailing function returned an error while trying to send the mail.
Check your mail server to ensure it is configured correctly to allow PHP to send mail from it. You should also check your mail server's error log for more diagnostic information.
I can't see no errors in /var/log/mail*

Any ideas?
Reply With Quote
  #4  
Old 1st July 2007, 23:52
Mr Blek Mr Blek is offline
Junior Member
 
Join Date: Jun 2006
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
Default

If I use the following code without the -f option:

Code:
<?php

// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('user@domain.com', 'My Subject', $message);

?>
The email is sent and the mail log outputs the following:

Code:
Jul  2 02:01:55 europa postfix/pickup[28530]: E7383B583C9: uid=30 from=<wwwrun>
Jul  2 02:01:55 europa postfix/cleanup[29251]: E7383B583C9: message-id=<20070702000155.E7383B583C9@europa.mydomain.com>
Jul  2 02:01:56 europa postfix/qmgr[25689]: E7383B583C9: from=<wwwrun@europa.mydomain.com>, size=345, nrcpt=1 (queue active)
Jul  2 02:01:57 europa postfix/smtp[29254]: E7383B583C9: to=<user@gmailcom>, relay=gmail-smtp-in.l.google.com[209.85.129.27]:25, delay=2, delays=0.14/0/1.4/0.4, dsn=2.0.0, status=sent (250 2.0.0 OK 1183334517 g28si14191589fkg)
Jul  2 02:01:57 europa postfix/qmgr[25689]: E7383B583C9: removed
However, if I now attempt sending an email with the -f option:

Code:
<?php

// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

$returnval = mail('user@domain.com', 'the subject', 'the message', null,
'-f webmaster@domain.com');
?>
No email is sent and nothing gets written to any of the mail logs (messages,mail, mail.err, mail.info, mail.warn). The variable $returnval is empty.

Last edited by Mr Blek; 2nd July 2007 at 02:48.
Reply With Quote
  #5  
Old 2nd July 2007, 09:35
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,419
Thanks: 812
Thanked 5,205 Times in 4,081 Posts
Default

Please use this example and not the sendmail parameters:

Code:
<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #6  
Old 2nd July 2007, 10:46
Mr Blek Mr Blek is offline
Junior Member
 
Join Date: Jun 2006
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by till
Please use this example and not the sendmail parameters:

Code:
<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

That sent the email fine, but the return path is still wwwrun@europa.domain.com. It should be the sender. Even if I stick in Return-Path: webmaster@domain.com it still gets overwritten with the wwwrun one.

Last edited by Mr Blek; 2nd July 2007 at 12:00.
Reply With Quote
  #7  
Old 2nd July 2007, 16:26
Mr Blek Mr Blek is offline
Junior Member
 
Join Date: Jun 2006
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
 
Default

Fixed it. Seems you can't use the -f param with php safe mode
Reply With Quote
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
4000 bounced email in one hour Hellbound General 7 9th January 2009 12:17
Postfix Email Delivery Problem sedat1903 HOWTO-Related Questions 2 22nd December 2008 11:19
Problem with 'CC' & 'BCC' email not being delivered. snowfly HOWTO-Related Questions 10 20th July 2006 12:36
Multiple MySQL Queries - with Postfix-mysql, courier-authmysql, maildrop-mysql... snowfly HOWTO-Related Questions 4 7th July 2006 04:19
email forwarding locally consumes all resources rdells General 20 1st May 2006 19:43


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


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