sendmail program

sendmail program

am 16.07.2009 21:01:28 von 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 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\@hotmail.com";
my $subject = "Subject: Testmail";
my $content = "Hello and how are you doing? This is the message body";



my $to = "To: bilashi_sahu\@yahoo.com";
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: SIZE=153
AUTH=bilashi@...
250 2.1.0 ... Sender ok
>>> RCPT To:
>>> DATA
250 2.1.5 ... 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



_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: sendmail program

am 16.07.2009 22:42:35 von Bill Luebkert

Bilashi Sahu wrote:
> 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\@hotmail.com";
> my $subject = "Subject: Testmail";
> my $content = "Hello and how are you doing? This is the message body";
>
>
>
> my $to = "To: bilashi_sahu\@yahoo.com";
> 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);

Nothing obvious there (not sure if the content type is needed), try
this alternate version just to see if it makes any difference:

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

use strict;
use warnings;

my $sendmail = '/usr/sbin/sendmail -t -oi';

my $addr = 'bilashi@hotmail.com';
my $subject = 'Testmail';
my $content = 'Hello and how are you doing? This is the message body';

open SENDMAIL, "|$sendmail" or die "$sendmail: $! ($^E)";
print SENDMAIL "To: $addr\n";
print SENDMAIL "From: $addr\n";
print SENDMAIL "Reply-to: $addr\n";
print SENDMAIL "Subject: $subject\n";
print SENDMAIL "\n";
print SENDMAIL "$content\n";
print SENDMAIL "\n";
close SENDMAIL;

__END__

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs