5

is it possible to do it without any third-party lib.

i can send mail to gmail with a simple socket functions. i can send files one computer to another too. But i need to send with attachment to any mail account...

can it be done with smtp?

(i searched in here but the answers, that i looked, are not in c++ or not on windows or not open source completely. Sorry if there is/are answer(s) that given before, but i couldn't find )

thanks,

H2O
  • 582
  • 3
  • 12
  • 1
    Why do you want to not use third-party libraries? – Anon. Feb 11 '10 at 21:32
  • first it must be totaly open source. Many of them are compiled... and secondly, some new features can be needed in future. i don't want to be depended... i have enough time to search for now... – H2O Feb 11 '10 at 21:56

1 Answers1

3

Absolutely yes.

As far as SMTP is concerned, you just provide it with the appropriate headers (the rfc822 is out of date, but is a good start) and then the message body, which can be anything.

You probably want to create a message body that is a MIME encoded message describing the text of the email and any attachments.

The question you should be asking is:

How do I construct a MIME encoded email message that I can send to SMTP?

Also, the problem of creating email messages and sending them has been solved so many times, you should really consider using a library if you're at all able to.

John Weldon
  • 39,849
  • 11
  • 94
  • 127
  • "How do I construct a MIME encoded email message that I can send to SMTP?" Yes that is the true question... – H2O Feb 12 '10 at 08:45