C++ : Send an Email.

Before I start, I want to say that I've spent the last 40 minutes searching on google, with no success.

Does anyone know of a way to easily send an email without the user knowing. I really wanted the function to be set up like this.

bool SendEmail (char * Subject, char * Message, char * Address);

It returns true if the email was sent successfully, false if not. The arguments are easy to understand, one for the subject/title, another for the message/body, and another for the address (who to send it to.)

Any help will be amazing, thanks!
I don't think there is any way to do this built in to C++. You are going to need a third party library. What is the purpose of this email by the way? Are you intending to send it with the user's email account?
I'm creating an application that has a contact feature, a request more options feature, ect. Just general things that will need a way to send information to me. I thought that email wold be the best way to do this. So it will always send an email to my email.

Do you know of any third party libraries that would work good for this?
Libcurl supports smtp protocol, among others, if you want to use it.
To me looks like a spyware application afaik
I think if it is all above board - then I think the OP/program should let the user know that the software contains this particular feature - I see no need to it in a covert underhand way.

read about pop/pop3 protocol. its easy to implement. You would be needing some basics of sockets though apart from C/C++.
searching the net you may get a pop client also with code.
POP3 is for receiving emails, not sending them.

To send e-mail, you need SMTP and a public IP with correctly setup DNS resolution (both ways). Sending email from behind NAT directly to someone's mailbox, without SMTP authorization, would very likely fail.
Last edited on

I don't remember properly but i have used pop some years back to send mail and i did receive the mail. :)

i used pop that time, don't know about pop3 though.
Just use any COM interface
Complete code in MSDN
Why would you want your application to "send an email without the user knowing?" Sounds pretty malicious to me... You said you want it to be for contact, but wouldn't you want your user to know how to contact you in that case? But if it isn't for malicious reasons, then you either need a third party library, or you need to find out how to implement PHP into your application (PHP supports an email function!)
Last edited on
...easily send an email without the user knowing...

Not possible, sending mail requires an open port. As long as ports can be enumerated and the handle traced back to the parent process, that would be your process, then there is always a way for the user to detect outgoing mail. The only way around this is to have a rootkit on their box and every layer the user has monitoring access to.

@ rapidcoder:
Sending email from behind NAT directly to someone's mailbox, without SMTP authorization, would very likely fail.

This will actually fail 100% of the time. Modern Mailbox servers use ACL's rather well.
There is another way, to setup a web server to send email for you and just POST data from your app to this web server using HTTP
@ modoran: Still detectable but less obvious and much simplier to implement. This is what the OP should do.
thats kind of fishy. are you trying to make som kind of virus?
Topic archived. No new replies allowed.