Sendmail

  • Thread starter Deepan Perl XML Parser
  • Start date

D

Deepan Perl XML Parser

my $email = populateEmail("test");
print $email;

open(SENDMAIL, "|/usr/lib/sendmail -oi -t -i") or print "cannot open
SENDMAIL: $!";
print SENDMAIL <<"EOF";
From: <deepan\@juniper.net>
To: ${email}
Subject: [SUSTAINING TICKET] Case
Content-type: text/html
testing
EOF
close(SENDMAIL);

The above code results in "No recipient address found in header"
but when i replace ${email} with direct address say deepan.
17\@gmail.com it works fine.

populateEmail function's code is available below:

sub populateEmail {
if(lc($_[0]) eq "test") {
return ("deepan.17\@gmail.com");
}
}

Can anyone spot the bug?
 
Ad

Advertisements

D

Deepan Perl XML Parser

Deepan Perl XML Parser wrote:




No. The code is ugly but it works.

which one works for you and which part of the code sounds ugly to you.
I haven't provided you the complete code but still you are able to
tell it ugly. good!
 
Ad

Advertisements

X

xhoster

Deepan Perl XML Parser said:
which one works for you

Either way worked for me. (I took the liberty of changing the email
address to point to me rather than you, however.)
and which part of the code sounds ugly to you.

The weird indentation of the close. The bad wrapping. The use of
"\@" when '@' would due instead. The unnecessary use of
brackets in ${email}. I also found the use of non-lexical file
handles somewhat ugly. Some of it is petty stuff, but you did ask.

I haven't provided you the complete code but still you are able to
tell it ugly. good!

You seem to have it backwards. We don't need to see all of the code
to know it is ugly. But we maybe do need to see all of the code to debug
it, if the bug is not in the part of the code you choose to show us.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
 

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

Top