sending mail with attachment in c++? (or How do I construct a MIME encoded email message that I can send to SMTP?) [duplicate]
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,
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.
精彩评论