Sendmail problem

J

jim

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);

}
 
N

nobull

jim said:
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.
 
J

jim

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.
 
N

nobull

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

Ignorance, incompetance and compassion.

For details, please see numerous previous theads.
 
N

nobull

jim said:
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.. ]
Haven't, just trying to get someone else's code working.

Have you tried adding it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top