Quote:
Originally Posted by
ldapguy
How do I add that to my script so that it goes through the IP to send the email?
Short answer: you shouldn't.
Long version: it is simply not the task of a script to "know how to deliver mails". This should be the knowledge of the mailing daemon and be configured there. "mail" (which you use in your script) is a client program which acts as a frontend to this delivery system: it takes a mail message with all relevant information (addressee, content, subject line, etc.) and passes this to a daemon (sendmail, whatever), which should deliver this to an MTA (mail transfer agent) or to the addressees systems mail service directly. In any case your script should not be concerned with how mail gets there.
To use an analogy: if you want to use any other IP service (say, FTP) in your script, it shouldn't be concerned in dealing with IP routing or something such either - this would be the job of routers, so let them do it.
Bottom line: configure your "sendmail" or whatever you use to send mails properly and leave your perfectly written script alone.
I hope this helps.
bakunin