interactive SMTP command using telnet via a shell script
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm trying to access a SMTP remote server thru a remote shell using telnet and a command file
containing command to send to that SMTP server as seen on
https://tecadmin.net/ways-to-send-email-from-linux-command-line/#
(note: that on the above website this is done interactivly) but here I want to do that inside a
command file (Iv just copied the yellow/red (the uses input)) to the command file marked
<<<<<<<<< >>>>>>>>>
<<<<<<<<<
HELO yahoo.com
mail from: sender@tecadmin.net
rcpt to: myemail@mail.com
data
Hey
This is test email only
Thanks
.
quit
>
telnet IP smtp < command.txt
this always returns
Trying 1.1.65.49...
Connected to 1.1.65.49.
Escape character is '^]'.
Connection closed by foreign host.
immediatly
whereas when I do it interactily
<<<<<<<<<<<
perlhook@bbis:~/temp_25$ telnet 1.1.65.49 smtp
Trying 1.1.65.49...
Connected to 1.1.65.49.
Escape character is '^]'.
220 miraino-manabi.jp ESMTP Postfix
HELO yahoo.com
250 miraino-manabi.jp
mail from: sender@tecadmin.net
250 2.1.0 Ok
rcpt to: myemail@ymail.com
554 5.7.1 : Relay access denied
^]
telnet> quit
>
I get a return codes 220 250 554
I'v also tried inside a here doc shell script
<<<<<<<<<<
telnet 1.1.65.49 smtp <
Hey
This is test email only
Thanks
.
quit
END_SCRIPT
>
and get the same results.
How can I get around this and make the script act as is it was interactive ?
Thank's in advance
shell-script smtp telnet interactive
New contributor
add a comment |Â
up vote
0
down vote
favorite
I'm trying to access a SMTP remote server thru a remote shell using telnet and a command file
containing command to send to that SMTP server as seen on
https://tecadmin.net/ways-to-send-email-from-linux-command-line/#
(note: that on the above website this is done interactivly) but here I want to do that inside a
command file (Iv just copied the yellow/red (the uses input)) to the command file marked
<<<<<<<<< >>>>>>>>>
<<<<<<<<<
HELO yahoo.com
mail from: sender@tecadmin.net
rcpt to: myemail@mail.com
data
Hey
This is test email only
Thanks
.
quit
>
telnet IP smtp < command.txt
this always returns
Trying 1.1.65.49...
Connected to 1.1.65.49.
Escape character is '^]'.
Connection closed by foreign host.
immediatly
whereas when I do it interactily
<<<<<<<<<<<
perlhook@bbis:~/temp_25$ telnet 1.1.65.49 smtp
Trying 1.1.65.49...
Connected to 1.1.65.49.
Escape character is '^]'.
220 miraino-manabi.jp ESMTP Postfix
HELO yahoo.com
250 miraino-manabi.jp
mail from: sender@tecadmin.net
250 2.1.0 Ok
rcpt to: myemail@ymail.com
554 5.7.1 : Relay access denied
^]
telnet> quit
>
I get a return codes 220 250 554
I'v also tried inside a here doc shell script
<<<<<<<<<<
telnet 1.1.65.49 smtp <
Hey
This is test email only
Thanks
.
quit
END_SCRIPT
>
and get the same results.
How can I get around this and make the script act as is it was interactive ?
Thank's in advance
shell-script smtp telnet interactive
New contributor
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to access a SMTP remote server thru a remote shell using telnet and a command file
containing command to send to that SMTP server as seen on
https://tecadmin.net/ways-to-send-email-from-linux-command-line/#
(note: that on the above website this is done interactivly) but here I want to do that inside a
command file (Iv just copied the yellow/red (the uses input)) to the command file marked
<<<<<<<<< >>>>>>>>>
<<<<<<<<<
HELO yahoo.com
mail from: sender@tecadmin.net
rcpt to: myemail@mail.com
data
Hey
This is test email only
Thanks
.
quit
>
telnet IP smtp < command.txt
this always returns
Trying 1.1.65.49...
Connected to 1.1.65.49.
Escape character is '^]'.
Connection closed by foreign host.
immediatly
whereas when I do it interactily
<<<<<<<<<<<
perlhook@bbis:~/temp_25$ telnet 1.1.65.49 smtp
Trying 1.1.65.49...
Connected to 1.1.65.49.
Escape character is '^]'.
220 miraino-manabi.jp ESMTP Postfix
HELO yahoo.com
250 miraino-manabi.jp
mail from: sender@tecadmin.net
250 2.1.0 Ok
rcpt to: myemail@ymail.com
554 5.7.1 : Relay access denied
^]
telnet> quit
>
I get a return codes 220 250 554
I'v also tried inside a here doc shell script
<<<<<<<<<<
telnet 1.1.65.49 smtp <
Hey
This is test email only
Thanks
.
quit
END_SCRIPT
>
and get the same results.
How can I get around this and make the script act as is it was interactive ?
Thank's in advance
shell-script smtp telnet interactive
New contributor
I'm trying to access a SMTP remote server thru a remote shell using telnet and a command file
containing command to send to that SMTP server as seen on
https://tecadmin.net/ways-to-send-email-from-linux-command-line/#
(note: that on the above website this is done interactivly) but here I want to do that inside a
command file (Iv just copied the yellow/red (the uses input)) to the command file marked
<<<<<<<<< >>>>>>>>>
<<<<<<<<<
HELO yahoo.com
mail from: sender@tecadmin.net
rcpt to: myemail@mail.com
data
Hey
This is test email only
Thanks
.
quit
>
telnet IP smtp < command.txt
this always returns
Trying 1.1.65.49...
Connected to 1.1.65.49.
Escape character is '^]'.
Connection closed by foreign host.
immediatly
whereas when I do it interactily
<<<<<<<<<<<
perlhook@bbis:~/temp_25$ telnet 1.1.65.49 smtp
Trying 1.1.65.49...
Connected to 1.1.65.49.
Escape character is '^]'.
220 miraino-manabi.jp ESMTP Postfix
HELO yahoo.com
250 miraino-manabi.jp
mail from: sender@tecadmin.net
250 2.1.0 Ok
rcpt to: myemail@ymail.com
554 5.7.1 : Relay access denied
^]
telnet> quit
>
I get a return codes 220 250 554
I'v also tried inside a here doc shell script
<<<<<<<<<<
telnet 1.1.65.49 smtp <
Hey
This is test email only
Thanks
.
quit
END_SCRIPT
>
and get the same results.
How can I get around this and make the script act as is it was interactive ?
Thank's in advance
shell-script smtp telnet interactive
shell-script smtp telnet interactive
New contributor
New contributor
New contributor
asked 9 mins ago
user2901196
1
1
New contributor
New contributor
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
user2901196 is a new contributor. Be nice, and check out our Code of Conduct.
user2901196 is a new contributor. Be nice, and check out our Code of Conduct.
user2901196 is a new contributor. Be nice, and check out our Code of Conduct.
user2901196 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476451%2finteractive-smtp-command-using-telnet-via-a-shell-script%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password