<update>I see GrandFather was faster and more concise than me</update>
qq("nafroz\@sunamerica.com","sdas\@sunamerica.com")
Creates a string that is literally
"nafroz\@sunamerica.com","sdas\@sunamerica.com"

Whereas

$smtp->to("nafroz\@sunamerica.com" , "sdas\@sunamerica.com");
is passing a list of two values, neither of which contain quotes, to the to() method. You can make the following changes ('#-' means remove the line it quotes, and replace it with the code following):
#- my $recepient = qq("nafroz\@sunamerica.com","sdas\@sunamerica.com") +; my @recepient = ("nafroz\@sunamerica.com","sdas\@sunamerica.com"); #- $smtp->to($recepient); $smtp->to(@recepient);

What I have done here is replace your scalar with an array that has your two addresses as members, then alter your call to to() so that it takes that list as the argument.

Larry Wall is Yoda: there is no try{}
The Code that can be seen is not the true Code

In reply to Re: Problem in adress field for email script. by radiantmatrix
in thread Problem in adress field for email script. by Nesh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.