PDA

View Full Version : Help



Help!
01-26-2003, 11:42 PM
I have made a Dos program in c++... regular dos. not true dos..
And in that program i am asking a cpl of questions, and i would like to know how to do so. When they questions are answered, all the facts are sent to my e-mail. someone help me with that plz.


BTW: hammer, i had to do that thread bumping, cos i had a black dot over the letter symbol sometimes <---, and when i tryed to watch the new replies, i had to write something, dunno why... thats why.. so fix ur board instead of naggin' on others plz.

GanglyLamb
01-27-2003, 05:16 AM
BTW: hammer, i had to do that thread bumping, cos i had a black dot over the letter symbol sometimes <---, and when i tryed to watch the new replies, i had to write something, dunno why... thats why.. so fix ur board instead of naggin' on others plz.
if it works with all the other ppl why wouldnt it work for you???


so fix ur board instead of naggin' on others plz.[/

mayb u have to fix something on ur comp instead of hammer fixin the board
:o

Hammer
01-27-2003, 06:52 AM
The black dot denotes that you have posted on this thread.

In answer to your question, emailing is gong to be pretty specific. What email facilities do you have available to you? Maybe you should read an RFC or two.

Waldo2k2
01-27-2003, 06:53 AM
look up winsock and leave us alone

Help!
01-27-2003, 10:13 AM
what do you mean with e-mail facilities. or W/E it was?...
Can't someone just write me a code? =D

Btw, no need to be hostile...

Cela
01-27-2003, 10:52 AM
I have no idea how to do this with C or C++ in DOS, but if I were you I'd pipe the output of your program through a Perl mailer script. This makes things mucho simple. :-)


#!/usr/bin/perl -w

use Mail::Mailer;

$self = "sender's address";
$address = "your address";

$send = Mail::Mailer->new();
$send->open({From => $self, To => $address, Subject => 'Facts'}) or die $!, "\n";

while (<>) {
print $send $_;
}

$send->close();

Then you can just collect the answers with strcat and do this


char mail[10000] = "mail.pl ";
strcat(mail, answers);
system(mail);

*disclaimer: I didn't test any of this, just wrote it off the top of my head. :-)

Hammer
01-27-2003, 02:52 PM
>>what do you mean with e-mail facilities.
What method do you intend to use to send the email? Do you want to connect to yur ISP's outbound mail server and post an email for them to send?

>>Can't someone just write me a code? =D
No. This board is here to help you learn, not to do your dirty work for you.

>>Btw, no need to be hostile...
Hostility comes from consistantly asking and never giving; from hassling people to get them to do work for you for free; from never showing any effort of your own; from disobeying rules; from stating other peoples systems are broken simply because you don't know how to use them. Etc etc etc. I hope you get the point.

People will be willing to help, just show some effort on your own part.

Anyway, here's a starter... the RFC for SMTP (http://www.ietf.org/rfc/rfc0821.txt)

Help!
01-27-2003, 04:46 PM
If i say it like this?

I want it to be mailed to my HOTMAIL!


What i am trying to tell you, is that i know just as much about c++ as a 3 year old baby..

this is my program

---------------------------------------------------------------------------------
#include <iostream>

using namespace std;
void main()
{
int Name,Age;
cout<<"What is your name?: ";
cin>>Name;
cout<<"How old are you?: ";
cin>>Age;
}
---------------------------------------------------------------------------------
That's all i want! and i want the fact to be send to my e-mail.. could that be sooo sooo hard?... someone.. plz

Cela
01-27-2003, 11:02 PM
>>could that be sooo sooo hard?
Yea, actually it can. :-) You have to open a socket to an SMTP server and speak its language to get the message properly sent. Sockets alone are enough to fill two or three books with a thousand pages. But using a nice glue language you can send the mail in less than 5 lines. Here's a perfectly working program that does what you want using Perl to send the message


#include <iostream>
#include <string>

using namespace std;

int main()
{
string name;

cout<<"What is your name? ";
getline(cin, name);

system(string("mail.pl " + name).c_str());
}

This is the script that the above program calls, change the single quoted strings to match your system, mine is shown


#!/usr/bin/perl -w

use Mail::Sendmail;

$name = shift;
%mail = ( SMTP => 'mail.mindspring.com',
To => 'ansley_parker@yahoo.com',
From => 'ansley_parker@yahoo.com',
Message => $name
);

sendmail(%mail) or die $Mail::Sendmail::error;

print $Mail::Sendmail::log;

Trust me when I say that doing what that Perl script does with C++ will be a *lot* longer and harder than you want. :-)

Help!
01-28-2003, 12:31 AM
still i have no idea how to put all of that togeather you sent me, and i dont really know pearl.. :/..

I got like first 34 errors: D... then like 5.....

Waldo2k2
01-28-2003, 07:07 AM
wow,
sorry, but you're not fit to be a programmer. He just wrote EVERYTHING for you, all you had to do was copy and paste it into 2 files. His second set of code should be whatever.pl, you don't need to know perl becuase he made the script for you.

GanglyLamb
01-28-2003, 09:56 AM
Help a good idea for you would be to start with a tutorial about the basic thing.
i mean programming isnt as simple as doing this


int sendit_to_my_hotmail_adress_right_now()
{
return 0;
}

so get urself a good tutorial (thatz my suggestion) to see what programming is really about;)

Help!
01-28-2003, 01:05 PM
i have programming in school, just started.. know a little, but not pearl.. only c++..
And i copied it all!.. and still, didnt work... had like 5 errors or something, gonna try it again lata.

Waldo2k2
01-28-2003, 04:11 PM
first off, put std:: in front of cout in the code.
second, do like gangly lamb said and go here (http://www.cprogramming.com/tutorial.html).
Third, it's PERL not pearl.

and finally listen when we say you are NOT ready for this yet. Learn the basics first (go through all the tutorials from the link i gave you) then come back and take a shot at it. And you don't have to know perl to use that script.

Cela
01-29-2003, 08:34 AM
>>And i copied it all!.. and still, didnt work...
Don't forget to download and install Perl. :-)

Help!
01-29-2003, 05:53 PM
but the thing is, when its suppose to send it all in the end...

it said something about "unknown command" and such things.. :/

Waldo2k2
01-29-2003, 09:34 PM
the .pl file has to exist and be in the same folder as your app....or you can put it anywhere and hard code the address into the program so it would be c:\\...\\whatever.pl (make sure to use double \'s). It says unknown command cause dos can't find the file and thinks you're trying to send it a command, at which point it chokes.

Help!
01-30-2003, 12:28 AM
Ok?... ill try some things =)...

Waldo2k2
01-30-2003, 01:25 PM
oh boy.....
from that last reply you made it seems like you're not getting things...so, my suggestion is that you read tutorials, and go here: www.planetsourcecode.com . I'm sure they'll have a program in the c++ section that will do what you want, the source will be included so you can compile and learn from it.

Help!
01-31-2003, 11:04 AM
ill read it through :D