Answer the question
In order to leave comments, you need to log in
How to send a message with SSL/TLS encryption in Winsock2?
Hello, tell me please, I use Winsock2
to send mail via SMTP server:
sockaddr_in sin = {0};
SOCKET s = socket(AF_INET, SOCK_STREAM, 0);
sin.sin_family = AF_INET;
sin.sin_port = htons(25);
sin.sin_addr.s_addr = inet_addr("77.88.21.158");
int err = connect(s, (sockaddr*)& sin, sizeof(sin));
char buff[4096];
memset(buff, '\0', sizeof(buff));
if (SOCKET_ERROR != err)
{
const char* msg[] = {
"EHLO yandex.ru\r\n",
"AUTH LOGIN\r\n",
"login\r\n", // Тут указываю логин от почты в base64
"pass\r\n", // Тут пароль в base64
"MAIL FROM:<[email protected]>\r\n",
"RCPT TO:<[email protected]>\r\n",
"DATA\r\n",
"Subject:hello\r\n",
"Hellow world gacpada \r\n\n.\r\n",
"CRLF.CRLF\r\n",
"QUIT\r\n"
};
for (int i = 0; i < 10; ++i)
{
send(s, msg[i], strlen(msg[i]), 0);
memset(buff, '\0', 4096);
recv(s, buff, 4096, 0);
MessageBoxA(NULL, buff, "Окно", MB_OK);
}
}
closesocket(s);
break;
email sending without ssl/tls encryption is not allowed
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question