Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #7613

Re: bash re-direction?

From Unknown <dog@gmail.com>
Newsgroups comp.os.linux.misc
Subject Re: bash re-direction?
Date 2013-03-24 10:14 +0000
Organization A noiseless patient Spider
Message-ID <kimjl1$1c1$1@dont-email.me> (permalink)
References <khpveb$b4l$1@dont-email.me> <khtf6k$8ig$1@dont-email.me>

Show all headers | View raw


On Thu, 14 Mar 2013 21:24:37 +0000, Chick Tower wrote:

> On 2013-03-13, Avoid9Pdf@gmail.com <Avoid9Pdf@gmail.com> wrote:
>> BTW if you've also been sweating-blood to get gmail to smtp NON-http,
>> this finally did it for me: openssl s_client -connect
>> smtp.gmail.com:465 -crlf -ign_eof
>>  BUT!!
> 
OK, I'm back on this dog-task!

> Could you please direct the rest of us to where you found this
> information?  It sounds useful to me, too.

When I started learning to read, I learned to spell c.a.t, but I didn't
make a record of the 'authority'.

Summary of progress to date, to smtp to gmail:---
Summary of progress to: ssl-connect to smtp.gmail.com:465

I have the following text visible, to copy the lines,
to paste to a shell/VT, and the indented numbers are what the gmail server
  should have in its reply -- for when I later extend this to a full 
script.
BTW, I previously used expect, with these confirming-numbers.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
openssl s_client -connect smtp.gmail.com:465 -crlf -ign_eof
    250

EHLO gmail.com
   250

AUTH LOGIN
 334

<MyName@gmail.com decoded to base64>
  334

<My-gmail password decoded to base64>
  235

MAIL FROM: <ME@gmail.com>
  250

RCPT TO:<CONFIRMadr.eas@gmail.com>
  250

DATA
  354

Subject: opensslc2LB 23 Mar
Date: 24 Mar 2013
Line after space-line separator
line-2
line-3
line-4
end with <CRLF>.<CRLF>
.

  250

quit
  221
~~~~~~~~~~~~~~~~ end of my 'copy template'~~~~~~~~~~~~

NB. the 'closing "." line must have no trailing spaces, so I do it by 
hand,
 instead of pasting.
========================================
My old accumulated notes contain:--
Newsgroups: comp.os.linux.misc
Subject: Re: need bash mail syntax help
From: Pascal Bourguignon <spam@thalassa.informatimago.com>

Grant Edwards <grante@visi.com> writes:

> In article <c1u7pr$1merb6$1@ID-178899.news.uni-berlin.de>, Anthony 
Ewell wrote:
> 
...
Why rely on external programs?  You only need a kernel and bash!

./smtp.sh sender@example.com recip-1@example.com recip-2@example.com <<EOF
#!/bin/bash
...
#AUTHORS
#    <PJB> Pascal Bourguignon <pjb@informatimago.com>
...
smtp_server=localhost
local_name=localhost
if [ "$1" = "--log" ] ; then shift ; trace=echo ; else trace=true ; fi
from="$1" ; shift # the rest of arguments are envelop recipients
log=/dev/tty
message=/tmp/message.$$
trap "rm $message" 0
cat>$message
(
    read line 0<&3 ; $trace "$line">$log
    case "$line" in 2*) ;; *) echo "QUIT" 1>&3 ; exit 0 ;; esac
    echo "HELO $local_name" 1>&3
    read line 0<&3 ; $trace "$line">$log
    case "$line" in 2*) ;; *) echo "QUIT" 1>&3 ; exit 0 ;; esac
    echo "MAIL FROM: <${from}>" 1>&3
...
        echo "." 1>&3
        read line 0<&3 ; $trace "$line">$log
        case "$line" in 
        2*) [ "$trace" != ":" ] && echo "Message sent">$log ;;
        *) echo "Could not send the emssage.">$log ;; 
        esac
    fi
    echo "QUIT" 1>&3
) 3<>/dev/tcp/$smtp_server/25   #  <---- transport to server !!
exit 0
~~~~~~~~~ end of extract ~~~~~~~~~~~~~~

The syntax which I don't understand and seems KEY to this & what
I'm trying to achieve is:--

cat>$message
(
...
) 3<>/dev/tcp/$smtp_server/25  

It's the complex interaction of various processes running 
that kills me.

Apparently `openssl` is set to run in the background.
And the standard-input is able to 'butt-in' too.
Automating it by a script, adds a further level of complication.

What I want to do is take the existing PROVEN, and wrap it
in a script. But UNDERSTAND how it works too.

== Chris Glur.


Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

bash re-direction? Avoid9Pdf@gmail.com - 2013-03-13 13:37 +0000
  Re: bash re-direction? "Chris F.A. Johnson" <cfajohnson@gmail.com> - 2013-03-13 17:12 -0400
  Re: bash re-direction? Chick Tower <c.tower@deadspam.com> - 2013-03-14 21:24 +0000
    A working incantation for openssl to gmail via SSL and TLS J G Miller <miller@yoyo.ORG> - 2013-03-14 22:01 +0000
      Re: A working incantation for openssl to gmail via SSL and TLS J G Miller <miller@yoyo.ORG> - 2013-03-14 22:18 +0000
    Re: bash re-direction? Unknown <dog@gmail.com> - 2013-03-24 10:14 +0000
      Re: bash re-direction? J G Miller <miller@yoyo.ORG> - 2013-03-24 15:47 +0000
        Re: bash re-direction? Unknown <dog@gmail.com> - 2013-03-25 18:19 +0000
          Re: bash re-direction? J G Miller <miller@yoyo.ORG> - 2013-03-25 20:01 +0000
            Re: bash re-direction? Chick Tower <c.tower@deadspam.com> - 2013-03-27 02:21 +0000
              Re: bash re-direction? J G Miller <miller@yoyo.ORG> - 2013-03-27 13:33 +0000
          Re: bash re-direction? The Natural Philosopher <tnp@invalid.invalid> - 2013-03-26 01:31 +0000
    Re: bash re-direction? Unknown <dog@gmail.com> - 2013-03-24 10:20 +0000

csiph-web