Loading ...
Sorry, an error occurred while loading the content.

sendmail program

Expand Messages
  • Bilashi Sahu
    Hi, I wrote following program to send an email to my email id, looks like it is running. But when I checked my mailbox, does not find any email. Can anybody
    Message 1 of 1 , Jul 14, 2009
    • 0 Attachment
      Hi,

      I wrote following program to send an email to my email id, looks like it is running. But when I checked my mailbox, does not find any email.
      Can anybody help me to find if anything I am missing here.
      I appreciate for your reply.

      thanks,

      Bilashi


      1.
      sendmail.pl
      ============

      #!/home/y/bin/perl -w


      # set up email message
      my $sendmail = "/usr/sbin/sendmail -t -v";
      my $reply_to = "Reply-to: bilashi\@...";
      my $subject = "Subject: Testmail";
      my $content = "Hello and how are you doing? This is the message body";



      my $to = "To: bilashi_sahu\@...";
      open(SENDMAIL, "|$sendmail") or die "Cannot send mail: $!";
      print SENDMAIL "$reply_to\n";
      print SENDMAIL "$subject\n";
      print SENDMAIL "$to\n";
      print SENDMAIL "Content-type: text/plain\n\n";
      print SENDMAIL "$content\n";
      print SENDMAIL "\.\n";
      close(SENDMAIL);


      2.

      When I ran this program looks like it is working

      perl sendmail.pl
      bilashi_sahu@...... Connecting to [127.0.0.1] via relay...
      220 materialbuilt.greatamerica.corp.yahoo.com ESMTP Sendmail 8.13.8/8.13.8; Tue, 14 Jul 2009 22:23:45 -0700
      >>> EHLO materialbuilt.greatamerica.corp.yahoo.com
      250-materialbuilt.greatamerica.corp.yahoo.com Hello localhost.localdomain [127.0.0.1], pleased to meet you
      250-ENHANCEDSTATUSCODES
      250-PIPELINING
      250-8BITMIME
      250-SIZE
      250-DSN
      250-ETRN
      250-AUTH DIGEST-MD5 CRAM-MD5
      250-DELIVERBY
      250 HELP
      >>> MAIL From:<bilashi@...> SIZE=153 AUTH=bilashi@...
      250 2.1.0 <bilashi@...>... Sender ok
      >>> RCPT To:<bilashi_sahu@...>
      >>> DATA
      250 2.1.5 <bilashi_sahu@...>... Recipient ok
      354 Enter mail, end with "." on a line by itself
      >>> .
      250 2.0.0 n6F5Njco010145 Message accepted for delivery
      bilashi_sahu@...... Sent (n6F5Njco010145 Message accepted for delivery)
      Closing connection to [127.0.0.1]
      >>> QUIT
    Your message has been successfully submitted and would be delivered to recipients shortly.