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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Backup report to SMTP server 1

Status
Not open for further replies.

sharper

MIS
Sep 4, 2001
109
0
0
IE
Hi there,

I'm looking to send the output of a backup report to my Exchange server. I am able to open a telnet session on port 25 from the SCO Openserver 5.05 box to my Exchange server fine and I thought that this might be a way to do it. Is there a way to script a telnet session? I don't need to login or anything just something like this:

telnet myexchangeserver.mydomain.local 25
helo
mail from:backupreport@mydomain.local
rcpt to:user@mydomain.local
data
"Actual Backup report text"
.
.

I don't really want to intall anything extra on the Unix box if I can avoid it as the database support team may not like it.
any suggestions would be appreciated.

best regards,

Oscar.
 
If you can locate a copy of "expect" for that version of SCO (it's standard in OpenServer6), you can create a simple script like this:

Code:
#!/usr/gnu/bin/expect -f
spawn telnet mailserver.mydomain.com 25
expect "*PDT)"
send "HELO scobox.mydomain.com\r"
expect "*you"
send "MAIL FROM: <me@mydomain.com>\r"
expect "*ok"
send "RCPT TO: <you@yourdomain.com>\r"
expect "*ok"
send "DATA\r"
expect "*itself"
send "Subject:  TestMail\r"
send "\r"
send "Message body\r"
send ".\r"
expect "*delivery"
send "QUIT\r"

As you can see, I'm not an expert with "expect". This examples leave no room for error handling. It was just a quick experiment which works on my system.
In this case, the message body is embedded into the script. You could make that content dynamic by other means.

"Proof that there is intelligent life in Oregon. Well, Life anyway.
 
Thanks a mil for that - looks perfect.

I've found expect on the skunkware cd and will get that installed and give it a try.

Thanks again

Oscar.
 
You will need to change the "expect" strings to match the responses you get from your Exchange Server. Fortunately, you already know how to perform this operation manually, so you'll be able to see those responses and modify your script to match.

This is sure easier than configuring MMDF or Sendmail, but not nearly as fool proof or useful. The other advantage is that you should be able to do all this without requiring "root" access (except for installing "expect").

Best of luck.

"Proof that there is intelligent life in Oregon. Well, Life anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top