Yaa trouble

Discussion in 'HOWTO-Related Questions' started by SkaBob, Jan 3, 2007.

  1. SkaBob

    SkaBob New Member

    I setup Yaa based on the tutorial on this site, and I'm having a problem.

    After a good chunk of work I got it to send autoreplies, but I'm having a problem with the content of those autoreplies.

    The subject and message body in this case are as follows:

    Subject: "I am out of the office"
    Body: "This is my autoreply. There are many like it, but this one is mine."

    When the messages actually send, the text is:

    Subject: "=?us-ascii?Q?I am out of the office?="
    Body: "?=
    MIME-Version: 1.0
    Content-Type: text/plain;
    charset="us-ascii"
    Content-Transfer-Encoding: Quoted-Printable

    This is my autoreply. There are many like it, but this one is mine."

    Also, no matter if I re-write the sender or not, the address the autoreply comes from is [email protected], instead of [email protected].

    Any help would be appreciated. I'm really running short on a deadline for this, so if it's possible that there's something quick I can do, I'd love to hear about it soon...
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Can you post the full sources of the email, including the headers?
     
  3. SkaBob

    SkaBob New Member

    Return-Path: <[email protected]>
    X-Original-To: [email protected]
    Delivered-To: [email protected]
    Received: from localhost (localhost [127.0.0.1])
    by cpimail.domain.net (Postfix) with ESMTP id 7B68948068
    for <[email protected]>; Thu, 4 Jan 2007 10:11:43 -0500 (EST)
    Received: from cpimail.domain.net ([127.0.0.1])
    by localhost (cpimail.domain.net [127.0.0.1]) (amavisd-new, port 10024)
    with ESMTP id ksEeEB5RhsA7 for <[email protected]>;
    Thu, 4 Jan 2007 10:11:43 -0500 (EST)
    Received: from localhost (localhost [127.0.0.1])
    by cpimail.domain.net (Postfix) with SMTP id 4E25A48098
    for <[email protected]>; Thu, 4 Jan 2007 10:11:43 -0500 (EST)
    Received: from cpimail (localhost [127.0.0.1])
    by cpimail.domain.net (Postfix) with ESMTP id 5DA5C48068
    for <[email protected]>; Thu, 4 Jan 2007 10:11:42 -0500 (EST)
    Message-ID: <1612882218.68551@cpimail>
    From: <[email protected]>
    To: "Bob Branch" <[email protected]>
    Reply-To: <>
    Date: Thu, 4 Jan 2007 10:11:42 -0500
    In-Reply-To: <[email protected]>
    References: <[email protected]>
    Auto-Submitted: auto-replied
    Precedence: bulk
    Subject: =?us-ascii?Q?Out of office=
    X-DSPAM-Result: Innocent
    X-DSPAM-Processed: Thu Jan 4 10:11:43 2007
    X-DSPAM-Confidence: 0.9899
    X-DSPAM-Improbability: 1 in 9809 chance of being spam
    X-DSPAM-Probability: 0.0000
    X-DSPAM-Signature: 459d192f32911205817754
    X-DSPAM-Factors: 27,
    Received*(localhost+[127.0.0.1]), 0.01000,
    ?=+MIME, 0.01000,
    Message-ID*cpimail>, 0.01000,
    or, 0.01000,
    to+L, 0.01000,
    Content, 0.01000,
    Content, 0.01000,
    References*domain.net>, 0.01000,
    of, 0.01000,
    Date*Jan+2007, 0.01000,
    M+Coomer, 0.01000,
    Received*ESMTP, 0.01000,
    Content+Type, 0.01000,
    Auto-Submitted*auto, 0.01000,
    1/08/07+MAY, 0.01000,
    THE, 0.01000,
    Received*Jan+2007, 0.01000,
    To*<rbranch+domain.net>, 0.01000,
    Subject*Out+of, 0.01000,
    From*<aperinoff+autoreply.domain.net>, 0.01000,
    ?=, 0.01000,
    advised, 0.01000,
    Geer+I, 0.01000,
    charset="us+ascii", 0.01000,
    Subject*office=, 0.01000,
    Received*by+cpimail.domain.net, 0.01000,
    will+return, 0.01000

    ?=
    MIME-Version: 1.0
    Content-Type: text/plain;
    charset="us-ascii"
    Content-Transfer-Encoding: Quoted-Printable

    Please be advised that I will be on the MOTHER SHIP the week of 1/01/07. Any questions or concerns please forward to L.Blower,M Coomer, S Geer. I will return to earths atmosphere on 1/08/07. MAY THE FORCE BE WITH YOU (DVIMCP)

    !DSPAM:459d192f32911205817754!
     
  4. SkaBob

    SkaBob New Member

    Of note, I tried using the sender_rewrite and recipient_rewrite to make it send the autoreplies from domain.net instead of autoreply.domain.net, and only the recipient_rewrite did anything. Nothing I set sender_rewrite to had any effect, but I could send it to whatever recipient I tried.
     
  5. falko

    falko Super Moderator Howtoforge Staff

    The problem is the empty line because by definition, the header and body of an email are seperated by an empty line. That's why you see

    Code:
    ?=
    MIME-Version: 1.0
    Content-Type: text/plain;
            charset="us-ascii"
    Content-Transfer-Encoding: Quoted-Printable
    in the mail's body. But I'm not sure what caused this. :confused:
     
  6. SkaBob

    SkaBob New Member

    As far as I can tell, it's the assigning of values to the variables for the subject and charset etc. fields that's causing the problem.

    I tried removing them being variables, but the script freaked out and yaa wouldn't start because somehow in the section the how-to put a patch up for (which, incidentally, does not fix this problem) - line 185 by my source - the variables for the charset and such are defined in the assignment of the subject header... I'm not a good enough perl coder to understand how to split it, or why you'd populate other variables within the declaration of one, but here's the line that all happens is:

    Code:
    push(@headers, "Subject: =?" . (($self->{charset}) ? $self->{charset} : $self->{default_charset}) . "?Q?" . encode_qp($subject) . "?=");
    
    (that's without the how-to's patch)
    Like I said, I'm not a perl coder, but it seems logical that line would produce

    Code:
    =?us-ascii?Q?Out of office=
    as the subject of the email. I tried setting that line to

    Code:
    push(@headers, "Subject: Out of office");
    and
    Code:
    push(@headers, "Subject: encode_qp($subject)";
    but was given errors when I tried to run yaa about the variable that stores the charset not being set, among other things. Can't test it at the moment to provide specific errors, the box is in production. I can this weekend if it'd help...

    I tried hard-setting the charset as a fix for that, and was given some error about it not liking the change because of it being written with use strict or something.

    I'm not exactly new to coding (just perl), but I've got to say it looks like a logic error in the code. If you're unfamiliar with this though, that'd make me the one instance of it, unless yaa's maintainer has put out a new rev of 0.3 since the how-to, without updating the version number...

    Do you think it could be a logic error, or is there something else I should be looking at? If it's useful info, I don't have the charset populated in the database record.
     
    Last edited: Jan 5, 2007
  7. falko

    falko Super Moderator Howtoforge Staff

    Have you tried to apply the patch? Alternatively, you could just replace that line with
    Code:
    push(@headers, "Subject: =?" . (($self->{charset}) ? $self->{charset} : $self->{default_charset}) . "?Q?" . encode_qp($subject,"") . "?=");
    (that's all the patch does).
     
  8. SkaBob

    SkaBob New Member

    I tried the patch, and got errors. I'll change it again after business hours and paste the error I get. The patch itself wouldn't apply correctly, so I ended up putting the change in by hand, and that's when I got the error.
     
  9. SkaBob

    SkaBob New Member

    OK... I applied the line of code manually and this time it worked. I must have fat fingered it before. The subject is normal now, and the message body no longer has the extra info in it.

    'course, now the reply-to field is empty, but I think in my test case that's operator error as well...I'll post if I'm still having trouble with it.

    Thanks for the help!
     

Share This Page