send Results to email

Jun 27, 2011 at 4:49pm
Ok so my question is how would i take the inputs of a user using my program and send to to my email or take their inputs aand write them to a wordpad or notepad file and then send it to my email. Is this possible to do this with C++? Are there any guides you can refer me to and how would i integrate this with a program I already have done? Heres an example of what I mean

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
#include<string>

using namespace std;

int main()
{string name;
 int age;
cout << "Please enter your name"<<endl;

cin>>name;

cout << "Now please enter your age"<<endl;


cin>>age;

//What would I type here to take all the cin inputs above to send them to a 
//specific email?


return 0;
}





Last edited on Jun 27, 2011 at 5:27pm
Jun 27, 2011 at 4:52pm
What operating system are you using?
Jun 27, 2011 at 5:01pm
Of course you can!
You can use sockets .It is available in http://www.linuxhowtos.org/C_C++/socket.htm ( for linux ) and in http://www.nullterminator.net/winsock.html for windows. Or you can search in google.
Jun 27, 2011 at 5:27pm
Im using Windows 7, so then how would I use socketing to take cin results to send it to a specific email? Does anyone have a small example source code that I can use and tweak as a basic starting?

And also

1
2
#include<string>
#include <windows.h>//Are the .h parts needed they usually work when i dont use them. 


And is it the coding different depending on which email site you use?
Jun 27, 2011 at 7:00pm
If you want to send mail at first you must log in to your mail server . You can send emails via pop3 protocol ( port 110 ).
Jun 27, 2011 at 11:58pm
I understand but i wanted to send it without prompting the user, kinda like a phishing program(Dont ask-_-) but the harder way...I think.
Last edited on Jun 28, 2011 at 12:00am
Jun 28, 2011 at 12:03am
Wouldn't it be simpler to download from a PHP script that does this for you? Having to set up or connect to a mail server is a huge hassle; getting a PHP script to send emails for you is little to no effort if you know some basic programming.
Topic archived. No new replies allowed.