How to tell Perl not to convert @mydomain.com part inside a body of message?

Discussion in 'Perl Misc' started by sams, Apr 30, 2004.

  1. sams

    sams Guest

    Hi

    Anyone help me how to tell perl not to convert the @MyDomain part of
    the inside a body of a mailmessage? In the
    received mails I do see only myname.com the @myDomain part is missing.
    Appreciate any help.

    Tks

    Sam.
    sams, Apr 30, 2004
    #1
    1. Advertising

  2. In article <>,
    sams <> wrote:
    :Anyone help me how to tell perl not to convert the @MyDomain part of
    :the inside a body of a mailmessage? In the
    :received mails I do see only myname.com the @myDomain part is missing.

    It isn't clear what connection perl has to your email ??

    For what you describe to be happening, you would have to be
    effectively -executing- the body of the email rather than just
    doing some kind of textual processing on it. If your script is
    doing that, it shouldn't be!!! What happens if someone sends you email
    that happens to include $ or % or ${} constructs?

    What I would suggest is that you edit your script, and on the #! line
    at the beginning, you add -T to turn on taint checking; and I
    suggest you use strict; use warnings; if you are not already doing
    so. If whatever problem you are seeing does have to do with your
    perl script, then between -T and using strict and warnings, you
    will probably find a number of places in your script that aren't
    properly written.
    --
    Rome was built one paycheck at a time. -- Walter Roberson
    Walter Roberson, Apr 30, 2004
    #2
    1. Advertising

  3. sams wrote:

    > Anyone help me how to tell perl not to convert the @MyDomain part of
    > the inside a body of a mailmessage? In the
    > received mails I do see only myname.com the @myDomain part is missing.
    > Appreciate any help.


    Without seeing your code, it's impossible to offer more than a guess...

    As a shot in the dark though, I'd guess that the email message is in a
    double-quoted string, so Perl is trying to interpolate the array @myDomain
    into that string.

    If you 'use strict' and 'use warnings', Perl would warn you about this and
    other problems. If you 'use diagnostics', it might even suggest a solution.

    sherm--

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
    Sherm Pendley, Apr 30, 2004
    #3
  4. In article <>,
    Sherm Pendley <> wrote:
    :Without seeing your code, it's impossible to offer more than a guess...

    :As a shot in the dark though, I'd guess that the email message is in a
    :double-quoted string, so Perl is trying to interpolate the array @myDomain
    :into that string.

    But it wouldn't try to do that unless you somehow try to execute
    the string. The email message is being read as input (somehow),
    and at that point perl is just going to be treating each character
    literally. If string $in happens to contain an @ then
    neither my $b = $in; nor my $b = "$in"; are going to try to do
    interpolation on the string contents.

    Possibly the script tries to use the input string as a pattern, such as

    s/$in/output/

    "Patterns are subject to an additional level of interpretation as a
    regular expression. This is done as a second pass, after variables are
    interpolated, so that regular expressions may be incorporated into the
    pattern from the variables."

    or perhaps the script uses the 'e' modifier on a substitute that
    has the input as the replacement portion. Or perhaps any of a number
    of other possibilities...
    --
    History is a pile of debris -- Laurie Anderson
    Walter Roberson, Apr 30, 2004
    #4
  5. sams

    Robin Guest

    "sams" <> wrote in message
    news:...
    > Hi
    >
    > Anyone help me how to tell perl not to convert the @MyDomain part of
    > the inside a body of a mailmessage? In the
    > received mails I do see only myname.com the @myDomain part is missing.
    > Appreciate any help.
    >
    > Tks
    >
    > Sam.


    Sam, it's be nice to see your code, however I had that exact same issue with
    one of my scripts... instead of using something like print MAIL
    ""; use print MAIL "myuser\@mydomain.com"; that way it
    won't try to interperate the array @mydomain -
    Hope this helps.
    -Robin
    Robin, Apr 30, 2004
    #5
  6. sams

    Robin Guest

    "Walter Roberson" <-cnrc.gc.ca> wrote in message
    news:c6ucua$edh$...
    > In article <>,
    > Sherm Pendley <> wrote:
    > :Without seeing your code, it's impossible to offer more than a guess...
    >
    > :As a shot in the dark though, I'd guess that the email message is in a
    > :double-quoted string, so Perl is trying to interpolate the array

    @myDomain
    > :into that string.
    >
    > But it wouldn't try to do that unless you somehow try to execute
    > the string. The email message is being read as input (somehow),
    > and at that point perl is just going to be treating each character
    > literally. If string $in happens to contain an @ then
    > neither my $b = $in; nor my $b = "$in"; are going to try to do
    > interpolation on the string contents.
    >
    > Possibly the script tries to use the input string as a pattern, such as
    >
    > s/$in/output/
    >
    > "Patterns are subject to an additional level of interpretation as a
    > regular expression. This is done as a second pass, after variables are
    > interpolated, so that regular expressions may be incorporated into the
    > pattern from the variables."
    >
    > or perhaps the script uses the 'e' modifier on a substitute that
    > has the input as the replacement portion. Or perhaps any of a number
    > of other possibilities...


    that's true...I didn't see that.
    -Robin
    Robin, Apr 30, 2004
    #6
  7. Walter Roberson wrote:

    > In article <>,
    > Sherm Pendley <> wrote:
    >
    > :As a shot in the dark though, I'd guess that the email message is in a
    > :double-quoted string, so Perl is trying to interpolate the array
    > :mad:myDomain into that string.
    >
    > But it wouldn't try to do that unless you somehow try to execute
    > the string.


    Not true. Try this simple example:

    #!/usr/bin/perl

    use strict;
    use warnings;
    use diagnostics;

    print "@hello, world!\n";

    With strict and warnings enabled, the above emits a warning about "possible
    unintended interpolation." With diagnostics, the warning includes a
    description of how to escape the @.

    Trust me - I worked at a hosting provider for six years, helping customers
    get their Perl scripts working. This is quite possibly the single most
    common bug that newbies encounter when they try to print an email address.

    sherm--

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
    Sherm Pendley, Apr 30, 2004
    #7
  8. In article <>,
    Sherm Pendley <> wrote:
    |Walter Roberson wrote:

    |> In article <>,
    |> Sherm Pendley <> wrote:

    |> :As a shot in the dark though, I'd guess that the email message is in a
    |> :double-quoted string, so Perl is trying to interpolate the array
    |> :mad:myDomain into that string.

    |> But it wouldn't try to do that unless you somehow try to execute
    |> the string.

    |Not true. Try this simple example:

    Ah, I just reviewed the original posting, and see that it was ambiguous.
    The original poster did not say that the perl script was sending email,
    and I read the posting as indicating that the poster has a script that
    is filtering email (somehow), due to the phrasing about the
    "received email".

    Yes, you are right that if the mail being sent is in a double-quoted
    string then perl would try to interpolate @myDomain . But if this
    is a case of a mail filter, then what I wrote holds. Having re-read the
    original message, I now think your interpretation of the situation
    is the more likely.
    --
    Inevitably, someone will flame me about this .signature.
    Walter Roberson, Apr 30, 2004
    #8
  9. Robin wrote:
    > Sam, it's be nice to see your code, however I had that exact same
    > issue with one of my scripts... instead of using something like print
    > MAIL ""; use print MAIL "myuser\@mydomain.com";
    > that way it won't try to interperate the array @mydomain -
    > Hope this helps.


    While this avoids the symptom it doesn't cure the desease.
    Just use single quotes instead of double quotes if you want variables _not_
    to be interpolated.

    jue
    Jürgen Exner, May 1, 2004
    #9
  10. sams

    Ala Qumsieh Guest

    "Jürgen Exner" <> wrote in message
    news:g1Ckc.11258$...
    > Robin wrote:
    > > Sam, it's be nice to see your code, however I had that exact same
    > > issue with one of my scripts... instead of using something like print
    > > MAIL ""; use print MAIL "myuser\@mydomain.com";
    > > that way it won't try to interperate the array @mydomain -
    > > Hope this helps.

    >
    > While this avoids the symptom it doesn't cure the desease.
    > Just use single quotes instead of double quotes if you want variables

    _not_
    > to be interpolated.


    Backwacking a literal @ in a double-quoted string *IS* a cure for the
    problem. I tend to use single quotes whenever I can, but if I ever needed a
    literal @ in a string where I also need to interpolate other variables, I
    will not hesitate to backslash it. There is nothing wrong with that.
    Afterall, TMTOWTDI.

    --Ala
    Ala Qumsieh, May 1, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bWc=?=

    Size of e-mail message - message.Body = msgText

    =?Utf-8?B?bWc=?=, Feb 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    557
    Chad Z. Hower aka Kudzu
    Feb 11, 2004
  2. - Steve -
    Replies:
    0
    Views:
    695
    - Steve -
    Jul 6, 2004
  3. SMG
    Replies:
    1
    Views:
    2,397
    Kevin
    Apr 26, 2005
  4. sgane
    Replies:
    1
    Views:
    676
    Paul Lutus
    Oct 11, 2004
  5. Replies:
    0
    Views:
    147
Loading...

Share This Page