UNIX script with smtp and telnet


 
Thread Tools Search this Thread
Operating Systems AIX UNIX script with smtp and telnet
# 1  
Old 05-09-2013
UNIX script with smtp and telnet

hi,
i have a problem ,

I'm creating a script that send a mail with telnet .
via command line it's ok,but i create the .sh i have problem .
this a .sh

telnet
open mysmtp 25
HELO
sleep 15
MAIL FROM:<Email>
sleep 15
RCPT TO:<email>
sleep 15
DATA


SUBJECT : PROVA

PROVA
CIAO
PROVA
.


QUIT
quit
# 2  
Old 05-09-2013
Whats the problem and how are you running the script?
# 3  
Old 05-09-2013
i running the .sh and
i receive this output :

pippo.sh
telnet>
# 4  
Old 05-09-2013
You need to use stdin redirection

Something like:
Code:
#!/usr/bin/ksh
telnet <<EndOfMail
open mysmtp  25
HELO
sleep 15
MAIL FROM:<Email>
sleep 15
RCPT TO:<email>
sleep 15
DATA


SUBJECT : PROVA

PROVA
CIAO
PROVA
.
EndOfMail

Hope this helps.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Smtp dual delivery script

Hello Peoples, I have a problem wrapping my head around a script that I modified, essentially it uses the postfix smtp line in master.cf to send out a message to two or more email servers, It is a nice way to test different email servers and platforms. Problem with the original script is that it... (0 Replies)
Discussion started by: SeSe
0 Replies

2. Shell Programming and Scripting

Configuring smtp settings and then sending the mail through shell script

I have make an menu in which first option is to start and second is to stop the services echo "Please enter the appropriate choice for doing the operations" echo " 1) STOP Services 2) START Services case $choice in 1) ... (1 Reply)
Discussion started by: punpun66
1 Replies

3. UNIX for Dummies Questions & Answers

how to check SMTP server details on Unix

Hi All, I am trying to figure out how to check SMTP server details on Unix enviornment? I tried using echo "hello" | sendmail -v abc@xyz.com and got following error: -bash: sendmail: command not found -bash: echo: write error: Broken pipe Any help will be much appreciated regarding... (2 Replies)
Discussion started by: palak08
2 Replies

4. Fedora

How to setup an smtp server on a UNIX machine !!!

How to setup an smtp server on a unix-based machine. For example ubuntu, mac os x, fedora. (4 Replies)
Discussion started by: 14opsrc
4 Replies

5. UNIX for Dummies Questions & Answers

How to block FTP ,SMTP,Telnet services?

My distribution details. # lsb_release -a LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: EnterpriseEnterpriseServer Description: Enterprise Linux Enterprise Linux Server release 5.2 (Carthage) Release: 5.2 Codename: ... (13 Replies)
Discussion started by: pinga123
13 Replies

6. Shell Programming and Scripting

Automating mailing via telnet to smtp

Hi, I am trying to write a ksh script to send an attachment via telnet to an SMTP server. I'm using MKS Toolkit. mail, mailx, sendmail, nc are not working on the server where I have MKS Toolkit installed. If I type the following from the command prompt I receive an email: telnet x.com... (0 Replies)
Discussion started by: dukeEarth
0 Replies

7. Shell Programming and Scripting

telnet smtp script

Hi, I have a mysql backup script located in crontab. I need to inform system administrator if the backup fail by telnet to smtp to send failure notification. ANyone got clue on how to achieve that? cheers. (4 Replies)
Discussion started by: bulkbiz
4 Replies

8. UNIX for Dummies Questions & Answers

telnet smtp and email in batch

I can do the following steps on my UNIX box interactively, but cannot send an email with a script. Can someone help? I need to send an email or some other notification when a cron job fails. telnet xx.yy.zz.ww 25 helo mail from: 123@123.com rcpt to: my@email.net data subject: email test... (1 Reply)
Discussion started by: ejaggers
1 Replies

9. UNIX for Advanced & Expert Users

Configure SMTP Server for Unix

Hi, We had an upgrade today morning and since then mailx command is not working. I have been told to change the DNS to use host name as smtp.companyname.com instead of the IP address. Can someone please help me out to know where can I change this on a Unix Server. Thanks Aman (5 Replies)
Discussion started by: chawlaaman
5 Replies
Login or Register to Ask a Question