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

S

sams

Hi

Anyone help me how to tell perl not to convert the @MyDomain part of
the (e-mail address removed) 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.
 
W

Walter Roberson

:Anyone help me how to tell perl not to convert the @MyDomain part of
:the (e-mail address removed) 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.
 
S

Sherm Pendley

sams said:
Anyone help me how to tell perl not to convert the @MyDomain part of
the (e-mail address removed) 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--
 
W

Walter Roberson

: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...
 
R

Robin

sams said:
Hi

Anyone help me how to tell perl not to convert the @MyDomain part of
the (e-mail address removed) 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
"(e-mail address removed)"; use print MAIL "myuser\@mydomain.com"; that way it
won't try to interperate the array @mydomain -
Hope this helps.
-Robin
 
R

Robin

Walter Roberson said:
: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
 
S

Sherm Pendley

Walter said:
: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--
 
W

Walter Roberson

|> In article <[email protected]>,

|> :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.
 
J

Jürgen Exner

Robin said:
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 "(e-mail address removed)"; 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
 
A

Ala Qumsieh

Jürgen Exner said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top