- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: telnet port 25 script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2002 07:10 PM
тАО03-01-2002 07:10 PM
Re: telnet port 25 script
Try using expect. This works for me but you have to customize my script based on your (eg. not SST) mail server's returning messages.
I have stripped my script down for ease of customization as follows:
#!/usr/bin/expect
set timeout 10
spawn telnet a.b.c.d 25
expect_background -re .+
expect "(SST)"
send "mail from: a@x.y.z\n"
expect "Sender ok"
send "rcpt to: z@a.b.c\n"
expect "Recipient ok"
send "data\n"
expect "by itself"
send "Your message here.\n"
send ".\n";
expect "Message accepted for delivery"
close
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2002 07:17 PM
тАО03-01-2002 07:17 PM
Re: telnet port 25 script
To see if the above conditions are true try this:
#echo test | mailx -s "This is a test" mike.skora@hawker.com
the -s is for subject
If this gets thru then you can pipe whatever you want into mailx commands.
HTH,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2002 04:33 AM
тАО03-02-2002 04:33 AM
Re: telnet port 25 script
First if you manually telnet to 193.0.9.27 25 does it answer?
If it answers, can you type in what you have in your script and does that work?
If the above are true then try rewriting your script to look more like:
(sleep 5
echo "username\r"
sleep 5
echo "password\r"
sleep 15
echo "date"
sleep 5
echo exit) |telnet otherboxipaddress portno
This is similar to what I use to talk to a 3Com switch. If I talk to a Cisco router I do not need the \r (I think I have the \ direction right. Working from my poor memory here. Could be /r. Not sure.) You have to substitute the appropriate values in each echo statement. The sleep statements are important and may need adjusting depending on how slow your remote system is. If, when you talk to the remote box, you have to give it an enter to wake it up that's echo "\r" or just echo.
Ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-06-2002 03:42 AM
тАО03-06-2002 03:42 AM
Re: telnet port 25 script
Having said that, *why* are you using telnet(1) to the SMTP port? Why don't you use sendmail(1M) to do the work for you? You can just pipe the header lines, a blank 'separation' line and the body lines to "sendmail -t". Or do you need to control the envelope (sp?) in addition to the headers and body?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-06-2002 03:46 AM
тАО03-06-2002 03:46 AM
Re: telnet port 25 script
you use the "!"- character as EOF- marker. In my opinion this could be the problem. Try another EOF- marker, like "EOF".
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-06-2002 11:29 AM
тАО03-06-2002 11:29 AM
Re: telnet port 25 script
Harry - I looked at your perl references, but got lost pretty quickly.
Steven - played with 'expect' but got lost there too.
Ron - manually entering each line of the script works - apparently since telnet is intended to be interactive only. Tried the sleep'ing suggestions but still couldn't get it to exit and complete.
Peter - tried a few other EOF marks, but with no success.
Jeff - 'mailx' fails because I messed up my sendmail configuration a while ago. That's why I was trying something "simple" like telnet.
Frank - telnet seemed like a good idea and easier than fumbling my way through the sendmail configuration. Apparently that's where I need to go though. Anyone know a good sendmail class I could attend?
Thanks again - I give.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-06-2002 12:12 PM
тАО03-06-2002 12:12 PM
Re: telnet port 25 script
Get the O'Reilly sendmail book - it's the "bat" book & while it's certainly comprehensive, it shouldn't be too over your head as long as you don't dwell on the rulesets - they've been known to make a person blind ;~). You want to focus on the configuration fields - EX: Setting=Value
And it explains the sendmail.cf & sendmail.cw files very well in addition.
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-06-2002 12:25 PM
тАО03-06-2002 12:25 PM
Re: telnet port 25 script
And in case you do want to go the class route - here's a link:
http://www.sendmail.org/classes.html
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-07-2002 12:34 AM
тАО03-07-2002 12:34 AM
Re: telnet port 25 script
{
echo "To: $TO"
echo "From: $FROM"
echo "Subject: $SUBJECT"
echo "Date: $DATE"
if [ ! -z "$MIME_Version" ]
then
echo "$MIME_Version"
fi
if [ ! -z "$Content_Type" ]
then
echo "$Content_Type"
fi
if [ ! -z "$boundary" ]
then
echo "$boundary"
fi
echo # Blank line because the body starts here:
cat /tmp/body$$
} | sendmail -t
I hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-14-2002 03:18 PM
тАО03-14-2002 03:18 PM
Re: telnet port 25 script
1) '/etc/hosts' has to have the correct domainname aliases associated with the Exchange server ip.
2) '/etc/mail/sendmail.cf' needs the correct domainname (eg: Dj$w.hawker.com in my case).
3) and '/etc/mail/sendmail.cw' needed 3 entries: hawk01us, hawk01us.hawker, and hawk01us.hawker.com to be happy.
After restarting the sendmail daemon with '# /sbin/init.d/sendmail stop' and then '# /sbin/init.d/sendmail start' I was able to execute "# mailx -s 'Happy at last' mike.skora@hawker.com < filename.txt" and see it in my Outlook inbox. Now I can go home.
- « Previous
-
- 1
- 2
- Next »