Hello, I am trying to setup stunnel to send email using gmail smtp server trough Oracle Database. 
I first tested on my windows machine. I installed and configured stunnel and it worked fine.
But now I tried to do the same on our server (RHEL 6.4) and it doesn't work.

I can successfuly telnet the 25 port:

[root@server1 stunnel]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mx.google.com ESMTP so2sm18740691pbc.5 - gsmtp

When I send the email, i receive this error: SMTP permanent error: 534 5.7.14 54 ef10sm21262349pac.1 - gsmtp

anyone have any idea?


the stunnel.conf:

pid = /stunnel.pid
output = /var/log/stunnel.log
compression = zlib
sslVersion = all
options = NO_SSLv2
debug = 7

[gmail-smtp]
client = yes
accept = localhost:25
connect = smtp.gmail.com:465


Here is the Stunnel log:
2013.11.17 15:58:34 LOG7[23729:139952118699968]: gmail-smtp accepted FD=13 from 127.0.0.1:56089
2013.11.17 15:58:34 LOG7[23729:139952118695680]: gmail-smtp started
2013.11.17 15:58:34 LOG7[23729:139952118695680]: FD 13 in non-blocking mode
2013.11.17 15:58:34 LOG7[23729:139952118695680]: Waiting for a libwrap process
2013.11.17 15:58:34 LOG7[23729:139952118695680]: Acquired libwrap process #0
2013.11.17 15:58:34 LOG7[23729:139952118695680]: Releasing libwrap process #0
2013.11.17 15:58:34 LOG7[23729:139952118695680]: Released libwrap process #0
2013.11.17 15:58:34 LOG7[23729:139952118695680]: gmail-smtp permitted by libwrap from 127.0.0.1:56089
2013.11.17 15:58:34 LOG5[23729:139952118695680]: gmail-smtp accepted connection from 127.0.0.1:56089
2013.11.17 15:58:34 LOG7[23729:139952118695680]: FD 14 in non-blocking mode
2013.11.17 15:58:34 LOG6[23729:139952118695680]: connect_blocking: connecting 74.125.129.108:465
2013.11.17 15:58:34 LOG7[23729:139952118695680]: connect_blocking: s_poll_wait 74.125.129.108:465: waiting 10 seconds
2013.11.17 15:58:34 LOG5[23729:139952118695680]: connect_blocking: connected 74.125.129.108:465
2013.11.17 15:58:34 LOG5[23729:139952118695680]: gmail-smtp connected remote server from 172.31.22.161:51067
2013.11.17 15:58:34 LOG7[23729:139952118695680]: Remote FD=14 initialized
2013.11.17 15:58:34 LOG7[23729:139952118695680]: SSL state (connect): before/connect initialization
2013.11.17 15:58:34 LOG7[23729:139952118695680]: SSL state (connect): SSLv2/v3 write client hello A
2013.11.17 15:58:34 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 read server hello A
2013.11.17 15:58:34 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 read server certificate A
2013.11.17 15:58:34 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 read server done A
2013.11.17 15:58:34 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 write client key exchange A
2013.11.17 15:58:34 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 write change cipher spec A
2013.11.17 15:58:34 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 write finished A
2013.11.17 15:58:34 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 flush data
2013.11.17 15:58:34 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 read server session ticket A
2013.11.17 15:58:34 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 read finished A
2013.11.17 15:58:34 LOG7[23729:139952118695680]:    1 items in the session cache
2013.11.17 15:58:34 LOG7[23729:139952118695680]:    1 client connects (SSL_connect())
2013.11.17 15:58:34 LOG7[23729:139952118695680]:    1 client connects that finished
2013.11.17 15:58:34 LOG7[23729:139952118695680]:    0 client renegotiations requested
2013.11.17 15:58:34 LOG7[23729:139952118695680]:    0 server connects (SSL_accept())
2013.11.17 15:58:34 LOG7[23729:139952118695680]:    0 server connects that finished
2013.11.17 15:58:34 LOG7[23729:139952118695680]:    0 server renegotiations requested
2013.11.17 15:58:34 LOG7[23729:139952118695680]:    0 session cache hits
2013.11.17 15:58:34 LOG7[23729:139952118695680]:    0 external session cache hits
2013.11.17 15:58:34 LOG7[23729:139952118695680]:    0 session cache misses
2013.11.17 15:58:34 LOG7[23729:139952118695680]:    0 session cache timeouts
2013.11.17 15:58:34 LOG6[23729:139952118695680]: SSL connected: new session negotiated
2013.11.17 15:58:34 LOG6[23729:139952118695680]: Negotiated ciphers: RC4-SHA SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=SHA1
2013.11.17 15:58:34 LOG7[23729:139952118695680]: SSL socket closed on SSL_read
2013.11.17 15:58:34 LOG7[23729:139952118695680]: Socket write shutdown
2013.11.17 15:58:34 LOG5[23729:139952118695680]: Connection closed: 90 bytes sent to SSL, 860 bytes sent to socket
2013.11.17 15:58:34 LOG7[23729:139952118695680]: gmail-smtp finished (0 left)
2013.11.17 16:01:01 LOG7[23729:139952118699968]: gmail-smtp accepted FD=13 from 127.0.0.1:56120
2013.11.17 16:01:01 LOG7[23729:139952118695680]: gmail-smtp started
2013.11.17 16:01:01 LOG7[23729:139952118695680]: FD 13 in non-blocking mode
2013.11.17 16:01:01 LOG7[23729:139952118695680]: Waiting for a libwrap process
2013.11.17 16:01:01 LOG7[23729:139952118695680]: Acquired libwrap process #0
2013.11.17 16:01:01 LOG7[23729:139952118695680]: Releasing libwrap process #0
2013.11.17 16:01:01 LOG7[23729:139952118695680]: Released libwrap process #0
2013.11.17 16:01:01 LOG7[23729:139952118695680]: gmail-smtp permitted by libwrap from 127.0.0.1:56120
2013.11.17 16:01:01 LOG5[23729:139952118695680]: gmail-smtp accepted connection from 127.0.0.1:56120
2013.11.17 16:01:01 LOG7[23729:139952118695680]: FD 14 in non-blocking mode
2013.11.17 16:01:01 LOG6[23729:139952118695680]: connect_blocking: connecting 74.125.129.109:465
2013.11.17 16:01:01 LOG7[23729:139952118695680]: connect_blocking: s_poll_wait 74.125.129.109:465: waiting 10 seconds
2013.11.17 16:01:01 LOG5[23729:139952118695680]: connect_blocking: connected 74.125.129.109:465
2013.11.17 16:01:01 LOG5[23729:139952118695680]: gmail-smtp connected remote server from 172.31.22.161:56971
2013.11.17 16:01:01 LOG7[23729:139952118695680]: Remote FD=14 initialized
2013.11.17 16:01:01 LOG7[23729:139952118695680]: SSL state (connect): before/connect initialization
2013.11.17 16:01:01 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 write client hello A
2013.11.17 16:01:01 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 read server hello A
2013.11.17 16:01:01 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 read finished A
2013.11.17 16:01:01 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 write change cipher spec A
2013.11.17 16:01:01 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 write finished A
2013.11.17 16:01:01 LOG7[23729:139952118695680]: SSL state (connect): SSLv3 flush data
2013.11.17 16:01:01 LOG7[23729:139952118695680]:    1 items in the session cache
2013.11.17 16:01:01 LOG7[23729:139952118695680]:    2 client connects (SSL_connect())
2013.11.17 16:01:01 LOG7[23729:139952118695680]:    2 client connects that finished
2013.11.17 16:01:01 LOG7[23729:139952118695680]:    0 client renegotiations requested
2013.11.17 16:01:01 LOG7[23729:139952118695680]:    0 server connects (SSL_accept())
2013.11.17 16:01:01 LOG7[23729:139952118695680]:    0 server connects that finished
2013.11.17 16:01:01 LOG7[23729:139952118695680]:    0 server renegotiations requested
2013.11.17 16:01:01 LOG7[23729:139952118695680]:    1 session cache hits
2013.11.17 16:01:01 LOG7[23729:139952118695680]:    0 external session cache hits
2013.11.17 16:01:01 LOG7[23729:139952118695680]:    0 session cache misses
2013.11.17 16:01:01 LOG7[23729:139952118695680]:    0 session cache timeouts
2013.11.17 16:01:01 LOG6[23729:139952118695680]: SSL connected: previous session reused
2013.11.17 16:01:02 LOG7[23729:139952118695680]: SSL socket closed on SSL_read
2013.11.17 16:01:02 LOG7[23729:139952118695680]: Socket write shutdown
2013.11.17 16:01:02 LOG5[23729:139952118695680]: Connection closed: 241 bytes sent to SSL, 825 bytes sent to socket
2013.11.17 16:01:02 LOG7[23729:139952118695680]: gmail-smtp finished (0 left)



Thanks a lot