how to send mails from VC++ program without using outlook
Hi everybody,
I m writting an application which calulates some results and send them thr e-mail.I want my VC++ program to send this mail to specified address without using Outlook Express or Microsoft Outlook...or without opening any browser window...in fact i want to send them undetected..that means user shud not know abt sending mails....plzzzzz anybody tell me how to do this..its urgent...do u think socket programming will do this?
Try looking into the tools by MarshallSoft, I have used their lib/dll e-mail tools for some time now with very very very good luck. They are very easy to code into your app and invisible to the user as they use their own functions and do not use Outlook or Outlook Express. They can be found at. www.marshallsoft.com
hi jim..thanks a lot for ur quick reply..but will u plz tell me in detail??i mean what shud i look for on this given url??and how can i use that tools in my code??is it necessary to load those tools on user's computer??plzzzzz reply back...its a bit urgent.
Re: how to send mails from VC++ program without using outlook
I m writting an application which calulates some results and send them thr e-mail.I want my VC++ program to send this mail to specified address without using Outlook Express or Microsoft Outlook...So You try to this link htttp://www.coolinterview.com
// Create input stream for reading email message file
string dir = "D:\\file.txt";
ifstream MsgFile(dir);
// Attempt to intialize WinSock (1.1 or later)
if(WSAStartup(MAKEWORD(VERSION_MAJOR, VERSION_MINOR), &WSData))
{
cout << "Cannot find Winsock v" << VERSION_MAJOR << "." << VERSION_MINOR << " or later!" << endl;
return 1;
}
// Lookup email server's IP address.
lpHostEntry = gethostbyname(szSmtpServerName);
if(!lpHostEntry)
{
cout << "Cannot find SMTP mail server " << szSmtpServerName << endl;
return 1;
}
// Create a TCP/IP socket, no specific protocol
hServer = socket(PF_INET, SOCK_STREAM, 0);
if(hServer == INVALID_SOCKET)
{
cout << "Cannot open mail server socket" << endl;
return 1;
}
// Get the mail service port
lpServEntry = getservbyname("mail", 0);
// Use the SMTP default port if no other port is specified
if(!lpServEntry)
iProtocolPort = htons(IPPORT_SMTP);
else
iProtocolPort = lpServEntry->s_port;
//iProtocolPort = 587;
// Send all lines of message body (using supplied text file)
MsgFile.getline(szLine, sizeof(szLine)); // Get first line
do // for each line of message text...
{
sprintf(szMsgLine, "%s%s", szLine, CRLF);
Check(send(hServer, szMsgLine, strlen(szMsgLine), 0), "send() message-line");
MsgFile.getline(szLine, sizeof(szLine)); // get next line.
} while(MsgFile.good());
// Send blank line and a period
sprintf(szMsgLine, "%s.%s", CRLF, CRLF);
Check(send(hServer, szMsgLine, strlen(szMsgLine), 0), "send() end-message");
Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() end-message");
Re: how to send mails from VC++ program without using outlook
Hi,
I am also using this program and it works for me if I use char (ascii), but as soon as I use unicode wchar to send the subject and the body, I get an email with a blank subject and body.
Any ideas why this is happening?
You'll want to look at the "SEE4C" Email engine for c/c++ under the "Products" listing, it does require a dll to be on the users computer to send email in the background. There is full documentation online for reference/programmer and can be viewed. I looked and tested many email tools over a 4 month trial for one of my apps and found this one to be the best and easiest to understand and get running quickly. They do offer eval versions also.
Well if this library be downloaded, can it be used for longer time? As it is evaluation version, i think there might be some what resisting the use for longer time.
Hello. When I run the program I get an error message like this. I would be glad if you help. Thank you in advance.
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|10|warning: ignoring #pragma comment |
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|13|error: ISO C++ forbids declaration of 'VERSION_MAJOR' with no type|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|14|error: ISO C++ forbids declaration of 'VERSION_MINOR' with no type|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp||In function 'void ShowUsage()':|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|20|error: 'cout' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|20|error: 'endl' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp||In function 'void Check(int, char*)':|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|32|error: 'cerr' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|32|error: 'endl' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp||In function 'int main(int, char**)':|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|60|error: 'ifstream' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|60|error: expected ';' before 'MsgFile'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|65|error: 'cout' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|65|error: 'endl' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|74|error: 'cout' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|74|error: 'endl' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|83|error: 'cout' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|83|error: 'endl' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|105|error: 'cout' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|105|error: 'endl' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|111|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|115|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|116|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|120|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|121|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|125|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|126|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|130|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|131|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|134|error: 'MsgFile' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|139|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|145|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|146|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|150|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|151|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|154|error: 'cout' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|154|error: 'endl' was not declared in this scope|
||=== Build finished: 19 errors, 15 warnings (0 minutes, 0 seconds) ===|
Hello. When I run the program I get an error message like this. I would be glad if you help. Thank you in advance.
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|10|warning: ignoring #pragma comment |
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|13|error: ISO C++ forbids declaration of 'VERSION_MAJOR' with no type|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|14|error: ISO C++ forbids declaration of 'VERSION_MINOR' with no type|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp||In function 'void ShowUsage()':|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|20|error: 'cout' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|20|error: 'endl' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp||In function 'void Check(int, char*)':|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|32|error: 'cerr' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|32|error: 'endl' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp||In function 'int main(int, char**)':|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|60|error: 'ifstream' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|60|error: expected ';' before 'MsgFile'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|65|error: 'cout' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|65|error: 'endl' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|74|error: 'cout' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|74|error: 'endl' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|83|error: 'cout' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|83|error: 'endl' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|105|error: 'cout' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|105|error: 'endl' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|111|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|115|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|116|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|120|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|121|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|125|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|126|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|130|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|131|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|134|error: 'MsgFile' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|139|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|145|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|146|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|150|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|151|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|154|error: 'cout' was not declared in this scope|
C:\Users\Hkn\Desktop\calisma\fb\main.cpp|154|error: 'endl' was not declared in this scope|
||=== Build finished: 19 errors, 15 warnings (0 minutes, 0 seconds) ===|
last right, then the error message as follows;
C: \ Users \ HKN \ Desktop \ working \ fb \ main.cpp | 11 | warning: ignoring # pragma comment |
C: \ Users \ HKN \ Desktop \ working \ fb \ main.cpp | 14 | error: ISO C + + forbids declaration of 'VERSION_MAJOR' with no type |
C: \ Users \ HKN \ Desktop \ working \ fb \ main.cpp | 15 | error: ISO C + + forbids declaration of 'VERSION_MINOR' with no type |
Well...the code I posted can basically copied directly into a console application. So simply create an empty console project, add an empty *.cpp file and copy/paste the whole code into the file...
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.