Wow! that was fast answer from this mailing list! Thanks a lot!
it works for the connection, I can say EHLO, and it answer, now, what is the rest of sending an email using ssl/tls as gmail ask for STARTTLS command which I send (I learned that by using telnet). But it answer unrecongnized command? So, I look at the variable and the starttls option was not there?! instead I had AUTH LOGIN, so I use auth login instead and then received the correct md5 question to my username, then password, then it replied: 535 5.7.1 Credentials Rejected??? what's that? is starttls on another port? (995) and why the authentification is only plain?
 
anyway, I enter my valid username and password after receiving the right answers (334 return from smtp server) but I get that rejected message?
 
SSL *ssl;
SSL_CTX *ctx;
void __fastcall TForm1::Button1Click(TObject *Sender)
{
 char reply[1024];
 SOCKET Socket;
 int read;
 SSL_library_init();
 SSL_METHOD* method = SSLv23_client_method();
 ctx = SSL_CTX_new(method);
 ssl = SSL_new(ctx);
 Socket = HttpConnect ("smtp.gmail.com", 465);
 read = SSL_set_fd(ssl, Socket);
 read = SSL_connect(ssl);
 read = SSL_get_error(ssl, read);
 read = SSL_read(ssl, reply, sizeof(reply));
 strcpy (reply, "EHLO smtp\n");
 SSL_write (ssl, reply, strlen (reply));
 read = SSL_read(ssl, reply, sizeof(reply));
 strcpy (reply, "AUTH LOGIN\n");
 SSL_write (ssl, reply, strlen (reply));
 read = SSL_read(ssl, reply, sizeof(reply));
 strcpy (reply, "********\n"); // my username
 SSL_write (ssl, reply, strlen (reply));
 read = SSL_read(ssl, reply, sizeof(reply));
 strcpy (reply, "******\n");  // my password
 SSL_write (ssl, reply, strlen (reply));
 read = SSL_read(ssl, reply, sizeof(reply));
 SSL_shutdown(ssl);
 SSL_free(ssl);
 SSL_CTX_free (ctx);
}

Bernhard Froehlich <[EMAIL PROTECTED]> wrote:
Serge wrote:

> So far, I have tried with ssl functions, then with BIO functions but
> without success. I have search an answer or documents explaining how
> to do that but not found.
>
> Here's what I do with ssl:
>
> SSL *ssl;
> SSL_CTX *ctx;
> void __fastcall TForm1::Button1Click(TObject *Sender)
> {
> char reply[1024];
> SOCKET Socket;
> int read;
>
> SSL_library_init();
> SSL_METHOD* method = SSLv23_client_method();
> ctx = SSL_CTX_new(method);
> ssl = SSL_new(ctx);
>
> // this is my own function that use windows socket
> Socket = HttpConnect ("smtp.gmail.com", 25);

Have you already tried to connect to port 465? To use SSL on port 25
you'll have to follow the TLS protocol, which needs some communication
via the insecure chann el. Also make sure that HttpConnect does not try
to initiate any handshake.

> // have tried to connect to google.com without success too!
> // Socket = HttpConnect ("www.google.com ", 80);
> read = SSL_set_fd(ssl, Socket);
>
> // connect always return -1, so I did not go further
> read = SSL_connect(ssl);

[...]

Kind regards,
Ted
;)
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager [EMAIL PROTECTED]


Do you Yahoo!?
The all-new My Yahoo! – What will yours do?

Reply via email to