Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Sendmail problem

Reply
Thread Tools

Sendmail problem

 
 
jim
Guest
Posts: n/a
 
      10-24-2003

Hello,

I am having a problem w/SendMail reporting: " No recipient addresses
found in header".

Funny thing is though, I properly recieve the email message.

Thanks for your help.

-jim



Here is the code:


sub my_send_mail
{
local($fromuser, $touser, $subject, $messagebody) = @_;

local($old_path) = $ENV{"PATH"};


$ENV{"PATH"} = "";
$ENV{ENV} = "";

open(SENDMAIL, "| /bin/sendmail -t -n") || &web_error ("Unable to open
sendmail");

$ENV{"PATH"} = $old_path;

print SENDMAIL "To: $touser\n";
print SENDMAIL "From: $fromuser\n";
print SENDMAIL "Subject: $subject\n\n";
print SENDMAIL "$messagebody\n";
close(SENDMAIL);

}
 
Reply With Quote
 
 
 
 
nobull@mail.com
Guest
Posts: n/a
 
      10-28-2003
jim <defenderjim4@no__spam__juno.com> wrote in message news:<D0imb.4736$(E-Mail Removed)>...

> I am having a problem w/SendMail


So why are you posting to a (non-existant) newsgroup that is (or
rather would be if it existed) about Perl?

> Here is the code:


That looks like it was written for Perl4. If it _was_ written for
Perl4 that's OK. But if this was written recently it implies the
author needs to update his Perl skills.

>
> sub my_send_mail
> {
> local($fromuser, $touser, $subject, $messagebody) = @_;


Do not use local() where you want my() unless you need your code to
run on Perl4. (You really should _not_ still be using Perl4).

> local($old_path) = $ENV{"PATH"};


>
> $ENV{"PATH"} = "";


No! That's one place where you could use local!

local $ENV{PATH} = '';

> $ENV{ENV} = "";
>
> open(SENDMAIL, "| /bin/sendmail -t -n") || &web_error ("Unable to open
> sendmail");


The there's another switch that is almost alwats used with 'sendmail
-t' to disable dot handling (can't recall what it is). Why have you
omitted it?

Why is that & there?

Why don't you include the error in your error message?

> $ENV{"PATH"} = $old_path;


You wouldn't need this if you'd used local.
 
Reply With Quote
 
 
 
 
jim
Guest
Posts: n/a
 
      10-30-2003
Hey nobull,

Thanks for your reply.

The short story is I got it working. There was something in the body of
the message that it didnt like.

The long response follows:


> So why are you posting to a (non-existant) newsgroup that is (or

Well, if it is non-existent, then why are all these messages here?

> That looks like it was written for Perl4. If it _was_ written for

Yeah, I think so. It is legacy code written by someone else and I have
had to work with it.

> Perl4 that's OK.

Yeah, I think so, dont know the original author or history.

> Do not use local() where you want my() unless you need your code to

No, does not need to run on perl4, changed above to my;

Note delimeter at end of previous sentance: I think I have been
programming too long when I end my sentences w/a semi colon.


> Why have you omitted it?

Haven't, just trying to get someone else's code working.

> Why don't you include the error in your error message?

Hhhmmm good point. Must have been late/tired.

 
Reply With Quote
 
nobull@mail.com
Guest
Posts: n/a
 
      10-30-2003
jim <m4@no_spam_juno.com> wrote in message news:<z%9ob.9562$(E-Mail Removed)>...
> > So why are you posting to a (non-existant) newsgroup that is (or

> Well, if it is non-existent, then why are all these messages here?


Ignorance, incompetance and compassion.

For details, please see numerous previous theads.
 
Reply With Quote
 
nobull@mail.com
Guest
Posts: n/a
 
      10-30-2003
jim <m4@no_spam_juno.com> wrote in message news:<z%9ob.9562$(E-Mail Removed)>...
> The short story is I got it working. There was something in the body of
> the message that it didnt like.


A line starting with a dot perhaps?

[ Re the swich to disable special treament for lines starting with a dot.. ]

> > Why have you omitted it?

> Haven't, just trying to get someone else's code working.


Have you tried adding it?
 
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
sendmail unicode problem Supra Perl 6 07-15-2008 03:24 AM
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
Mailman - Sendmail problem swangdb Python 3 08-21-2006 07:45 PM
Urgent SendMail Problem Andrea Williams ASP .Net 7 12-13-2004 06:05 PM



Advertisments