Friday, September 6, 2013

C++ Send EMail + Win32 w/ Download

Hello fellow coders,

[Image: dm-613784255382.png]

It is coded purely C/C++.

Also, the part that consumed most of my time in this project was base64 encryption. I was initially thinking of just ripping one online but couldn't. All the sources used external libraries and if you know me, I hate doing that. Not to mention, I had no patience to read over the external library and copy/paste it and adjust to the modifications of my project.

So I went ahead and implemented my own retarded base64 encryption, which works fine. I followed this: Base64 Wikipedia

It's pretty simple and VERY basic.

Basic outline of the program:
Code:
connect to smtp.gmail.com on port 25
Client: EHLO mail.gmail.com\r\n
Client: AUTH LOGIN\r\n
Client: base64 encrypted email\r\n
Client: base64 encrypted password\r\n
Server: 250 Accepted. --This is important to check.
Client: MAIL FROM: <emailid>\r\n
Client: RCPT TO: <toemailid>\r\n
DATA\r\n
Client: From: uremailid\r\n
Client: To: toemailid\r\n
Client: Subject: somesubject\r\n
Client: \r\n
Client: somemessageyouwanttosend\r\n
Client: .\r\n by sending period, it represents end of message.

The commands above are the ones sent to GMail server. That's all that's needed to send an EMail along with base64 encoder.

oh also, this is a very messy code, with little to no error handling. So, it's not perfect. It finishes its job though: send email. I didn't think about efficiency that much; I just wanted to get it done.

Download Link: http://uploading.com/e422f2f9/Emailer-rar

Source:
main.cpp
resource.rc
resource.h

Thanks and regards,

1 comment:

  1. very nice post about programming C++ Send EMail + Win32 w/ Download. Thank you frend for your great information.

    ReplyDelete