how to send mails from VC++ program without using outlook
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 4 1234 LastLast
Results 1 to 15 of 47

Thread: how to send mails from VC++ program without using outlook

Hybrid View

  1. #1
    Join Date
    Jun 2004
    Posts
    9

    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?

    thanx in advance

  2. #2
    Join Date
    May 2004
    Location
    45,000FT Above Nevada
    Posts
    1,538
    sushb4u,

    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


    HTH Good luck

    Jim

  3. #3
    Join Date
    Jun 2004
    Posts
    9
    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.

    again thanks in advance.

  4. #4
    Join Date
    May 2011
    Posts
    0

    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
    Last edited by Radhaa; May 9th, 2011 at 11:30 PM.

  5. #5
    Join Date
    Oct 2011
    Posts
    1

    Re: how to send mails from VC++ program without using outlook

    Please someone help me im trying 1 week to use this code.

    I m getting error on this line : if(connect(hServer, (PSOCKADDR) &SockAddr, sizeof(SockAddr)))

    Please see error screenshot

    This is my code :


    #define WIN32_LEAN_AND_MEAN

    #include <stdio.h>
    #include <iostream>
    #include <fstream>
    #include <stdlib.h>
    //#include <fstream.h>
    //#include <iostream.h>
    #include <windows.h>
    #include <winsock2.h>

    using namespace std;

    #pragma comment(lib, "ws2_32.lib")

    // Insist on at least Winsock v1.1
    const int VERSION_MAJOR = 1;
    const int VERSION_MINOR = 1;

    #define CRLF "\r\n" // carriage-return/line feed pair

    void ShowUsage(void)
    {
    cout << "Usage: SENDMAIL mailserv to_addr from_addr messagefile" << endl
    << "Example: SENDMAIL smtp.myisp.com rcvr@elsewhere.com my_id@mydomain.com message.txt" << endl;

    exit(1);
    }

    // Basic error checking for send() and recv() functions
    void Check(int iStatus, char *szFunction)
    {
    if((iStatus != SOCKET_ERROR) && (iStatus))
    return;

    cerr << "Error during call to " << szFunction << ": " << iStatus << " - " << GetLastError() << endl;
    }

    int main(int argc, char *argv[])
    {
    int iProtocolPort = 587;
    char szSmtpServerName[64] = "smtp.gmail.com";
    char szToAddr[64] = "lester555@gmail.com";
    char szFromAddr[64] = "555lester@gmail.com";
    char szBuffer[4096] = "lester555@gmail.com";
    char szLine[255] = "vai vai vaiiii";
    char szMsgLine[255] = "vai vai vaiiii";
    SOCKET hServer;
    WSADATA WSData;
    LPHOSTENT lpHostEntry;
    LPSERVENT lpServEntry;
    SOCKADDR_IN SockAddr;

    argc = 5;

    // Check for four command-line args
    if(argc != 5)
    ShowUsage();

    // Load command-line args
    lstrcpy(szSmtpServerName, argv[1]);
    lstrcpy(szToAddr, argv[2]);
    lstrcpy(szFromAddr, argv[3]);

    // 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;

    // Setup a Socket Address structure
    SockAddr.sin_family = AF_INET;
    SockAddr.sin_port = iProtocolPort;
    SockAddr.sin_addr = *((LPIN_ADDR)*lpHostEntry->h_addr_list);

    // Connect the Socket

    if(connect(hServer, (PSOCKADDR) &SockAddr, sizeof(SockAddr)))
    {
    cout << "Error connecting to Server socket" << endl;

    DWORD err = ::GetLastError();

    LPVOID lpMsgBuf;

    FormatMessage(
    FORMAT_MESSAGE_ALLOCATE_BUFFER |
    FORMAT_MESSAGE_FROM_SYSTEM |
    FORMAT_MESSAGE_IGNORE_INSERTS,
    NULL,
    GetLastError(),
    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
    (LPTSTR) &lpMsgBuf,
    0,
    NULL );

    MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
    cout << (LPCTSTR)lpMsgBuf << endl;
    system("pause");
    return 1;
    }

    // Receive initial response from SMTP server
    Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() Reply");

    // Send HELO server.com
    sprintf(szMsgLine, "HELO %s%s", szSmtpServerName, CRLF);
    Check(send(hServer, szMsgLine, strlen(szMsgLine), 0), "send() HELO");
    Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() HELO");

    // Send MAIL FROM: <sender@mydomain.com>
    sprintf(szMsgLine, "MAIL FROM:<%s>%s", szFromAddr, CRLF);
    Check(send(hServer, szMsgLine, strlen(szMsgLine), 0), "send() MAIL FROM");
    Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() MAIL FROM");

    // Send RCPT TO: <receiver@domain.com>
    sprintf(szMsgLine, "RCPT TO:<%s>%s", szToAddr, CRLF);
    Check(send(hServer, szMsgLine, strlen(szMsgLine), 0), "send() RCPT TO");
    Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() RCPT TO");

    // Send DATA
    sprintf(szMsgLine, "DATA%s", CRLF);
    Check(send(hServer, szMsgLine, strlen(szMsgLine), 0), "send() DATA");
    Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() DATA");

    // 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");

    // Send QUIT
    sprintf(szMsgLine, "QUIT%s", CRLF);
    Check(send(hServer, szMsgLine, strlen(szMsgLine), 0), "send() QUIT");
    Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() QUIT");

    // Report message has been sent
    cout << "Sent " << argv[4] << " as email message to " << szToAddr << endl;

    // Close server socket and prepare to exit.
    closesocket(hServer);

    WSACleanup();

    return 0;
    }
    Attached Images Attached Images  

  6. #6
    Join Date
    Dec 2011
    Posts
    1

    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?

  7. #7
    Join Date
    May 2004
    Location
    45,000FT Above Nevada
    Posts
    1,538
    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.


    Jim

  8. #8
    Join Date
    May 2003
    Location
    Jodhpur -> Rajasthan -> INDIA
    Posts
    453
    Hi Vanaj

    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.

    Any comments
    Leave Your Mark Wherever You Go
    http://www.danasoft.com/sig/d0153030Sig.jpg

  9. #9
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    The following is a simple console application which sends an email...
    Code:
    #define WIN32_LEAN_AND_MEAN
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <fstream.h>
    #include <iostream.h>
    #include <windows.h>
    #include <winsock2.h>
    
    #pragma comment(lib, "ws2_32.lib")
    
    // Insist on at least Winsock v1.1
    const VERSION_MAJOR = 1;
    const VERSION_MINOR = 1;
    
    #define CRLF "\r\n"                 // carriage-return/line feed pair
    
    void ShowUsage(void)
    {
      cout << "Usage: SENDMAIL mailserv to_addr from_addr messagefile" << endl
           << "Example: SENDMAIL smtp.myisp.com rcvr@elsewhere.com my_id@mydomain.com message.txt" << endl;
     
      exit(1);
    }
    
    // Basic error checking for send() and recv() functions
    void Check(int iStatus, char *szFunction)
    {
      if((iStatus != SOCKET_ERROR) && (iStatus))
        return;
      
      cerr << "Error during call to " << szFunction << ": " << iStatus << " - " << GetLastError() << endl;
    }
    
    int main(int argc, char *argv&#091;&#093;)
    {
      int         iProtocolPort        = 0;
      char        szSmtpServerName&#091;64&#093; = "";
      char        szToAddr&#091;64&#093;         = "";
      char        szFromAddr&#091;64&#093;       = "";
      char        szBuffer&#091;4096&#093;       = "";
      char        szLine&#091;255&#093;          = "";
      char        szMsgLine&#091;255&#093;       = "";
      SOCKET      hServer;
      WSADATA     WSData;
      LPHOSTENT   lpHostEntry;
      LPSERVENT   lpServEntry;
      SOCKADDR_IN SockAddr;
    
      // Check for four command-line args
      if(argc != 5)
        ShowUsage();
    
      // Load command-line args
      lstrcpy(szSmtpServerName, argv&#091;1&#093;);
      lstrcpy(szToAddr, argv&#091;2&#093;);
      lstrcpy(szFromAddr, argv&#091;3&#093;);
    
      // Create input stream for reading email message file
      ifstream MsgFile(argv&#091;4&#093;);
    
      // 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;
    
      // Setup a Socket Address structure
      SockAddr.sin_family = AF_INET;
      SockAddr.sin_port   = iProtocolPort;
      SockAddr.sin_addr   = *((LPIN_ADDR)*lpHostEntry->h_addr_list);
    
      // Connect the Socket
      if(connect(hServer, (PSOCKADDR) &SockAddr, sizeof(SockAddr)))
      {
        cout << "Error connecting to Server socket" << endl;
    
        return 1;
      }
    
      // Receive initial response from SMTP server
      Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() Reply");
    
      // Send HELO server.com
      sprintf(szMsgLine, "HELO %s%s", szSmtpServerName, CRLF);
      Check(send(hServer, szMsgLine, strlen(szMsgLine), 0), "send() HELO");
      Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() HELO");
    
      // Send MAIL FROM: <sender@mydomain.com>
      sprintf(szMsgLine, "MAIL FROM:<%s>%s", szFromAddr, CRLF);
      Check(send(hServer, szMsgLine, strlen(szMsgLine), 0), "send() MAIL FROM");
      Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() MAIL FROM");
    
      // Send RCPT TO: <receiver@domain.com>
      sprintf(szMsgLine, "RCPT TO:<%s>%s", szToAddr, CRLF);
      Check(send(hServer, szMsgLine, strlen(szMsgLine), 0), "send() RCPT TO");
      Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() RCPT TO");
    
      // Send DATA
      sprintf(szMsgLine, "DATA%s", CRLF);
      Check(send(hServer, szMsgLine, strlen(szMsgLine), 0), "send() DATA");
      Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() DATA");
    
      // 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");
    
      // Send QUIT
      sprintf(szMsgLine, "QUIT%s", CRLF);
      Check(send(hServer, szMsgLine, strlen(szMsgLine), 0), "send() QUIT");
      Check(recv(hServer, szBuffer, sizeof(szBuffer), 0), "recv() QUIT");
    
      // Report message has been sent
      cout << "Sent " << argv&#091;4&#093; << " as email message to " << szToAddr << endl;
    
      // Close server socket and prepare to exit.
      closesocket(hServer);
    
      WSACleanup();
    
      return 0;
    }
    Attachments need to be sent by encoding the message in MIME format. You can find the RFC at http://www.nacs.uci.edu/indiv/ehood...45/rfc2045.html for example.

    Additionally you might take a look at http://codeproject.com/internet/csmtpconn.asp. It wraps the SMTP protocol including the mentioned MIME attachments...
    Last edited by Andreas Masur; July 1st, 2004 at 08:53 AM.
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  10. #10
    Join Date
    May 2011
    Posts
    3

    Re: HELP

    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) ===|

  11. #11
    Join Date
    May 2011
    Posts
    3

    Re: HELP

    Quote Originally Posted by HkN View Post
    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 |

    Codeblocks in the meantime, I use the IDE.

  12. #12
    Join Date
    May 2011
    Posts
    2

    Re: how to send mails from VC++ program without using outlook

    I am also having the problem with the code errors. The exact same, actually.

  13. #13
    Join Date
    Jun 2004
    Location
    India
    Posts
    432
    Investigate MAPI, look at CDONTS.DLL
    Say no to supplying ready made code for homework/work assignments!!

    Please rate this post!

  14. #14
    Join Date
    Jun 2004
    Posts
    9
    Hi Andreas,

    how to execute this code??if i create new console application where to add this code??

  15. #15
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    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...
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

Page 1 of 4 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center