Sending email using gmail smtp (secure layer) in C ++

Has anyone had success with gmail smtp servers? smtp.gmail.com send emails from c ++ code? I know that it uses a safe level, but I do not know how to implement this.

+2
source share
3 answers

This is what I used. This was for linux, however, it should technically work with windows

http://johnwiggins.net/jwsmtp/

Textbooks are and redirect forward

http://johnwiggins.net/jwsmtp/example1.html

Here is a copy and paste from a site showing ports and an SMTP server. Credit goes to john wiggins

     jwsmtp::mailer mail(to.c_str( ),
                     from.c_str( ),
                     subject.c_str( ),
                     mailmessage.c_str( ),
                     smtpserver.c_str( ),
                     jwsmtp::mailer::SMTP_PORT,
                     false);

For authentication

mail.username("loginname");
mail.password("secret");
mail.authtype(mailer::PLAIN);  

LOGIN PLAIN, LOGIN , PLAIN authtype

+2

- SMTP-.

Thunderbird , .

+1

Sending to GMail through an SSL connection on port 465 really works right. You establish a connection, you initialize SSL / handshake, then send a command EHLO, and this is the usual way from there. You will also need a username or basic authentication with the server to receive your messages.

0
source

Source: https://habr.com/ru/post/1722888/


All Articles