winapi - Send mail through gmail SMTP server using Win API -


I use Gmail's SMTP server smtp.gmail.com to send mail in C I'm trying to get Windows I am able to connect to port 587 of the server, although the server says that STARTTLS / TLS is required. Is there a Windows API call to start a TLS connection?

Should I consider writing this application in C or using Python?

EDIT: Is anyone sending mail using smtp.gmail.com using Telnet? What got me

  220 mx.google.com ESMTP g4sm73428740wae.2 HELO Hello 502 5.5.1 Unrecognized command. G4sm73428740wae.2HELO hello.hello 250mx.google.com By email to your service: a@gmail.com 530 5.7.0 First of all, a STARTTLS order should be issued. G4sm73428740wae.2 STARTTLS 220 2.0.0 Starting with TLS Mail: a@gmail.com  

and the connection is lost

You can use NAT features for SSL / TLS support via SMTP or to use OpenSSL, a NAT wrapper around Microsoft SMTPLLent is needed. Take care of the connection

It may be beneficial for you to write in C ++. I'm not familiar with Python, but I'm sure (edit: see below, smtplib apparently You also have this functionality) such as

Edit: Depending on your editing, you should have a program that should handle the STARTTLS command . Gmail requires a secure connection and username / password on all SMTP connections by default. You can connect to port 25, but after the initial connection you have to switch to a secure port. This is the reason that, when you go, it automatically switches to the https connection. There was a big discussion on the Internet some time back ..


Comments