Hi Monks,
I have a program that sends out e-mails as part of the response it gets from some users. The program was working fine until it decided to stop, it runs but it doen't send out e-mails anymore. I went trough the code already and can't find anything that might be the cause of the problem since the program runs till the end. Maybe someone can tell me where my error is or suggest a better why to do it. Here is my code, and thank you very much!

#!/perl/bin/perl #use strict; use IO::SOCKET::INET; use DBI; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); print "Starting e-mail test...\n"; $mailto[0]="me\@yahoo.com"; $mailto[1]="me\@google.com"; #IP 111.111.111.11 for showing only foreach my $element (@mailto) { my $sock = IO::Socket::INET->new (PeerAddr => '111.111.111.11' +, Type => 'SOCK_STREAM ', PeerPort => 'smtp(25)', Proto => 'tcp')|| die "That sucks, I can't o +pen a port on The mail server. I'm going to take all my toys and go h +ome now.."; my $input = <$sock>; print $sock "HELO localhost\r\n"; $input = <$sock>; print $sock "mail from:me\@yahoo.com\r\n"; $input = <$sock>; print $sock "rcpt to:$element\r\n"; print "rcpt to:$element\r\n"; $input = <$sock>; print $sock "DATA\r\n"; print $sock "Subject: Assignment Test\r\n"; print $sock "From: Appraiser Test\r\n"; print $sock "To: $element\r\n"; print $sock "\r\n"; print $sock "You have received a Response..."; print $sock ". Please click on the following link for details +... \r\n"; print $sock "\r\n\r\n\r\n"; print $sock ".\r\n"; $input = <$sock>; print $sock "QUIT"; close ($sock); } print "End test";

Edit by BazB: add readmore tags


In reply to Sending e-mail problem by Anonymous Monk

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.