Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > sendmail

Reply
Thread Tools

sendmail

 
 
kd
Guest
Posts: n/a
 
      09-28-2005
Hi all,

I am working on a program which uses sendmail.I found that the sendmail
directory was located at /usr/sbin/sendmail. I try to execute the
following piece of code. But the program shows any errors nor executing
it properly.Could you please let me know what the problem could
be.Thanks in advance.

- Karthik
================================================== =
#!/usr/bin/perl/
use strict;
use diagnostics;
use warnings;
system('clear');

open(SENDMAIL,"|/usr/sbin/sendmail -oi -t -odq")or die "Can't fork for
sendmail: $!\n";
print SENDMAIL <<"EOF";
From: Karthik <karthik\@kmail.com>
To: Karthik <karthik\@kmail.com>
Subject: A relevant subject line
Hey Wats up !!
EOF
close(SENDMAIL) or warn "sendmail didn't close nicely";
================================================== =

 
Reply With Quote
 
 
 
 
A. Sinan Unur
Guest
Posts: n/a
 
      09-29-2005
"kd" <(E-Mail Removed)> wrote in
news:(E-Mail Removed) oups.com:

> I am working on a program which uses sendmail.I found that the
> sendmail directory was located at /usr/sbin/sendmail.


Is that the directory, or the full path to the binary?

> I try to execute the following piece of code. But the program shows
> any errors nor executing it properly.


Well, what are the errors it shows?

> #!/usr/bin/perl/


This is incorrect.

#!/usr/bin/perl

....

> print SENDMAIL <<"EOF";
> From: Karthik <karthik\@kmail.com>
> To: Karthik <karthik\@kmail.com>
> Subject: A relevant subject line
> Hey Wats up !!
> EOF
> close(SENDMAIL) or warn "sendmail didn't close nicely";


Don't you need to signal the end of the message to sendmail by sending a
..CRLF to sendmail?

Sinan

--
A. Sinan Unur <(E-Mail Removed)>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/cl...uidelines.html
 
Reply With Quote
 
 
 
 
Shane
Guest
Posts: n/a
 
      09-29-2005
On Wed, 28 Sep 2005 16:35:26 -0700, kd wrote:

> Hi all,
>
> I am working on a program which uses sendmail.I found that the sendmail
> directory was located at /usr/sbin/sendmail. I try to execute the
> following piece of code. But the program shows any errors nor executing it
> properly.Could you please let me know what the problem could be.Thanks in
> advance.
>
> - Karthik
> ================================================== = #!/usr/bin/perl/
> use strict;
> use diagnostics;
> use warnings;
> system('clear');
>
> open(SENDMAIL,"|/usr/sbin/sendmail -oi -t -odq")or die "Can't fork for
> sendmail: $!\n";
> print SENDMAIL <<"EOF";
> From: Karthik <karthik\@kmail.com>
> To: Karthik <karthik\@kmail.com>
> Subject: A relevant subject line


you need a blank line between your headers ^^ above and your body below

> Hey Wats up !!
> EOF
> close(SENDMAIL) or warn "sendmail didn't close nicely";
> ================================================== =



--
Hardware, n.: The parts of a computer system that can be kicked

The best way to get the right answer on usenet is to post the wrong one.

 
Reply With Quote
 
Shane
Guest
Posts: n/a
 
      09-29-2005
On Thu, 29 Sep 2005 13:00:11 +1200, Shane wrote:

> On Wed, 28 Sep 2005 16:35:26 -0700, kd wrote:


>> open(SENDMAIL,"|/usr/sbin/sendmail -oi -t -odq")or die "Can't fork for



Oh and.. should there be a pipe in your path?

"|/usr/sbin/sendmail"
^^^
--
Hardware, n.: The parts of a computer system that can be kicked

The best way to get the right answer on usenet is to post the wrong one.

 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      09-29-2005
Shane <(E-Mail Removed)-a-geek.net> wrote in
news(E-Mail Removed)-a-geek.net:

> On Thu, 29 Sep 2005 13:00:11 +1200, Shane wrote:
>
>> On Wed, 28 Sep 2005 16:35:26 -0700, kd wrote:

>
>>> open(SENDMAIL,"|/usr/sbin/sendmail -oi -t -odq")or
>>> die "Can't fork for

>
> Oh and.. should there be a pipe in your path?
>
> "|/usr/sbin/sendmail"
> ^^^


Yes.

perldoc -f open

perldoc -q send

Sinan


--
A. Sinan Unur <(E-Mail Removed)>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/cl...uidelines.html
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      09-29-2005
Shane <(E-Mail Removed)-a-geek.net> wrote:
> On Thu, 29 Sep 2005 13:00:11 +1200, Shane wrote:
>
>> On Wed, 28 Sep 2005 16:35:26 -0700, kd wrote:

>
>>> open(SENDMAIL,"|/usr/sbin/sendmail -oi -t -odq")or die "Can't fork for

>
>
> Oh and.. should there be a pipe in your path?
>
> "|/usr/sbin/sendmail"
> ^^^



Of course there should be.


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      10-07-2005
A. Sinan Unur <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> "kd" <(E-Mail Removed)> wrote in
> news:(E-Mail Removed) oups.com:


[...]

> > print SENDMAIL <<"EOF";
> > From: Karthik <karthik\@kmail.com>
> > To: Karthik <karthik\@kmail.com>
> > Subject: A relevant subject line
> > Hey Wats up !!
> > EOF
> > close(SENDMAIL) or warn "sendmail didn't close nicely";

>
> Don't you need to signal the end of the message to sendmail by sending a
> .CRLF to sendmail?


No, closing its input is enough. You need dot-on-a-line to make sendmail
quit *before* it reaches eof.

Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      10-07-2005
http://www.velocityreviews.com/forums/(E-Mail Removed)-berlin.de (Anno Siegel) wrote in
news:di5oh3$rab$(E-Mail Removed)-Berlin.DE:

> A. Sinan Unur <(E-Mail Removed)> wrote in comp.lang.perl.misc:
>> "kd" <(E-Mail Removed)> wrote in
>> news:(E-Mail Removed) oups.com:

>
> [...]
>
>> > print SENDMAIL <<"EOF";
>> > From: Karthik <karthik\@kmail.com>
>> > To: Karthik <karthik\@kmail.com>
>> > Subject: A relevant subject line
>> > Hey Wats up !!
>> > EOF
>> > close(SENDMAIL) or warn "sendmail didn't close nicely";

>>
>> Don't you need to signal the end of the message to sendmail by
>> sending a .CRLF to sendmail?

>
> No, closing its input is enough. You need dot-on-a-line to make
> sendmail quit *before* it reaches eof.


I learn something new every day. Thanks.

Sinan

--
A. Sinan Unur <(E-Mail Removed)>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/cl...uidelines.html
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [sendmail,perl] How to catch a mailer error [perl script as sendmail.cf mailer] Andrzej Adam Filip Perl 0 03-31-2008 09:24 PM
Unable to load tag handler class "com.cj.smtp.Sendmail" for tag "send:Sendmail" sugapablo Java 0 09-21-2007 01:41 PM
Mozilla and Sendmail cm Firefox 1 07-18-2005 03:05 AM
Sendmail problem jim Perl 4 10-30-2003 06:29 PM
Chomp not working properly with Sendmail Aaron Powell Perl 0 07-24-2003 02:24 PM



Advertisments