Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

email format in bounced messages

Quote Reply
email format in bounced messages
Hello, I have Gmail 2.2.0 installed and have a problem with bounced message formatting.

I am using qmail and the Gmail shared mbox method for mail delivery with the domain setup on the server as a virtualhost.

qmail file contents:

../qmail/control/virtualdomains:
Code:
mydomain.com:mydomain.com


../qmail/control/rcpthosts:
Code:

localhost
mydomain.com


../qmail/users/assign:
Code:

+mydomain.com-:mydomain.com:500:500:/path/to/mbox:-::
.


for local delivery, qmail rewrites an incoming email addressed to username@mydomain.com like this:
mydomain.com-username@mydomain.com

local mail delivery works fine. the issue is the format of email addresses in bounced mail. bounced mail returns an error like this for example:

"I'm afraid I wasn't able to deliver your message
to 'mydomain.com-badusername@mydomain.com'. Reason: Could not find a user to deliver the message to."

the tag that inserts this address in the "bounce message" email template is
Code:
<%envelope_to%>
what would be the best way to resolve this issue so bounced messages show a correctly-formatted email address? in this case like this: badusername@mydomain.com.

thanks for any help
Quote Reply
Re: [zeke] email format in bounced messages In reply to
This was fixed in 2.2.1. If you don't want to upgrade, then all you need to do is change outgoing.pl around line 143:
Code:
$opts{envelope_to} = $head->get('X-GMail-To') || $head->get('X-Envelope-To') || $head->get('Delivered-To') || $head->get('To');
to:
Code:
$opts{envelope_to} = $head->get('X-GMail-To') || $head->get('X-Envelope-To') || $head->get('Delivered-To') || $head->get('To');
$opts{envelope_to} =~ /\@(.*)/;
$opts{envelope_to} =~ s/^\Q$1\E\-//i;
[edit]Sorry, diff'ed the wrong version[/edit]

Adrian

Last edited by:

brewt: Feb 14, 2004, 2:42 AM
Quote Reply
Re: [brewt] email format in bounced messages In reply to
thanks for the quick reply Adrian. much appreciated!
Quote Reply
Re: [brewt] email format in bounced messages In reply to
Hi.

I have a similar problem but i tired finding the code. The best that i have is:

$opts{envelope_to} = $head->get('X-GMail-To') || $head->get('X-Envelope-To') || $head->get('Delivered-To') || $head->get('To');

I can't find that bit in my outgoing.pl

In my case the following is the case:

mail.domain.com-user@server1.somedomain.com where server1.somedomain.com is the server name basically.

For the above, the

To : user@domain.com

How exactly, could the bounce message be made to

I'm afraid I wasn't able to deliver your message
to 'mail.domain.com-user@server1.somedomain.com'

be user@domain.com

Anup
Quote Reply
Re: [anup123] email format in bounced messages In reply to
Sorry about that. I diff'ed the wrong version, so you actually wouldn't have had the first bit of code. I've corrected it.

Unfortunately, due to your strange mail server setup, you'll have to customise that change like you had to with your incoming.pl. You have to look for mail.domain.com at the beginning instead of just domain.com.

Adrian
Quote Reply
Re: [brewt] email format in bounced messages In reply to
            for my $domain (@{$account->{domains}}) {
if (m/$VALID_CHARACTERS\@\Q$domain\E/i) {
push @tos, $_;
}
elsif (m/$domain-($VALID_CHARACTERS)\@/) {
push @tos, "$1\@$domain";
}

}
}Red portion is what was added to the incoming.pl to take care of
the wierd setup.So what needs to be added to the outgoing.pl