Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I use sendmail if installed in different directory? 1

Status
Not open for further replies.

ChrisbChicken

Technical User
Sep 30, 2006
3
US
The problem I think I'm running into is that my hosting company has sendmail installed in a different directory than Perl. All the standard code works fine but the sendmail part of my code doesn't execute because my CGI page can't see sendmail. I don't know how to allow my sendmail code to use that other directory. Anyway, I guess my question is, am I on the right track, and if I am how do accomplish the directory thing? I'm pretty new to perl and know just enough to get into trouble.
 
Actually, the perl path is /usr/local/bin/perl and the sendmail module path is /usr/sbin/sendmail. I put /usr/local/bin/perl in my shebang but I don't know how to point my code to the /usr/sbin/sendmail path after that.
 
You don't. The shebang specifies where to find the interpreter. In a script you would use something like this to call it:
Code:
open (MAIL, '| /usr/lib/sendmail -t -oi');

Of course there is a lot missing from this code but my point is that most of the time you just point to sendmail unless you have mail::mailer module from cpan. In that case you would refer to the module.

 
Thank you so much. That's the line of code I've been looking for. My page is communicating with Sendmail now.

I am having another problem though. I get this error from sendmail "No recipient addresses found in header." If I take out the -oi I get a different but similar error. If I replace the -oi with a -f it doesn't give me an error at all, but the email doesn't go out in any of those situations. I hate to bother you guys with all these noob questions, but I'm really having a hard time getting this working. If it would help I'll post my code. Is there something obvious that I'm probably doing wrong?
 
You are very welcome but we are getting a little off topic. If you need help with coding there are forums here fore just about any programing and scripting language out there. A great place to get your mitts on some great code is or depending on the scripting language you prefer. All programs are free to download and since they are all gpl, you are welcome to use the script and mess with the code all you want. You may want to take peek at a few of the form mail programs to see how they do it. Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top