I'm trying to send email from my application. I can send email by smtp.mail.yahoo.com, however while I'm trying to send the email with gmail (smtp.gmail.com) it fails.
I'm using SocketPro.
I've try to use also openSSL but I don't know how to use it!
Anyone you have any code sample, that you can provide me, to send email from Gmail?
I have the following:
USocketClass m_ClientSocket;
m_ClientSocket.Send(Encoding.UTF8.GetBytes("EHLO smtp.gmail.com \r\n"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("AUTH LOGIN"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes(EncodeTo64(myUser)));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes(EncodeTo64(myPass)));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("MAIL FROM: <[email protected]>"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("RCPT TO: <[email protected]>"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("DATA"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("From: <[email protected]>"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("To: <[email protected]>"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("Subject: Test subject"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("My body test"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("."));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("\r\n"));
m_ClientSocket.Send(Encoding.UTF8.GetBytes("QUIT"));
can you help me?
Thanks.
Andrew