google-site-verification: googlebaca44933768a824.html [NEED HELP] sending e-mail ( smtp protocol ) - Old Royal Hack Forum

Announcement

Collapse
No announcement yet.

[NEED HELP] sending e-mail ( smtp protocol )

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [NEED HELP] sending e-mail ( smtp protocol )

    hi guys.

    after hours of trying to get some working code to smtp auth and send a e-mail i decided to ask here if somebody got sum working codingz. :wheelchair:

    ( ps: no, i dont need any links here...i prefer the pure code )

    thx.
    I 0x90 you!

    #2
    Originally posted by aVitamin
    hi guys.

    after hours of trying to get some working code to smtp auth and send a e-mail i decided to ask here if somebody got sum working codingz. :wheelchair:

    ( ps: no, i dont need any links here...i prefer the pure code )

    thx.
    Language?
    Outbreak -

    Comment


      #3
      i think avitamin codes in c++ only

      Comment


        #4
        hahahahahaha easy what language u need help in? hahahaha omg avitamine hahahaha made my day haha :b
        Chiroz - 41 64 61 6D

        Comment


          #5
          Originally posted by HuЯЯ1cΛиΞ? View Post
          i think avitamin codes in c++ only
          you mean i c & p in c++ only
          I 0x90 you!

          Comment


            #6
            If its C++, the easiest way is to sent a HTTPRequest (GET) to a PHP Script that sends it automatically

            Comment


              #7
              Originally posted by Turv View Post
              If its C++, the easiest way is to sent a HTTPRequest (GET) to a PHP Script that sends it automatically
              no, no already solved in plain c++ :P
              I 0x90 you!

              Comment


                #8
                for the ppl that want to know how to :
                Just use winsock to connect to a smtp server and send command like how you did with telnet
                (HELO xxx.xx / Mail From: / etc...)

                Comment


                  #9
                  Originally posted by houarican View Post
                  for the ppl that want to know how to :
                  Just use winsock to connect to a smtp server and send command like how you did with telnet
                  (HELO xxx.xx / Mail From: / etc...)

                  Sure thats easy... But how about without the SMTP server? How use winsock to send the email itself. The program would act as an SMTP server itself! Thats what I'm looking for...

                  aVitamin: you said you've solved it?

                  Well could you show how you solved it?

                  Comment


                    #10
                    ton of example anywhere just google it :O

                    :D
                    Free SMTP Server List

                    & 1 example found @ code guru via google


                    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, "bufferoverflowu.lib")
                    #pragma comment(lib, "ws2_32.lib")
                    
                    // Insist on at least Winsock v1.1
                    const VERSION_MAJOR = 1;
                    const VERSION_MINOR = 1;
                    
                    #define CRLF "rn"                 // carriage-return/line feed pair
                    
                    void ShowUsage(void)
                    {
                      cout << "Usage: SENDMAIL mailserv to_addr from_addr messagefile" << endl
                           << "Example: SENDMAIL smtp.myisp.com [email protected] [email protected] message.txt" << endl;
                    
                      system("pause");
                      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        = 0;
                      char        szSmtpServerName[64] = "";
                      char        szToAddr[64]         = "";
                      char        szFromAddr[64]       = "";
                      char        szBuffer[4096]       = "";
                      char        szLine[255]          = "";
                      char        szMsgLine[255]       = "";
                      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[1]);
                      lstrcpy(szToAddr, argv[2]);
                      lstrcpy(szFromAddr, argv[3]);
                    
                      // Create input stream for reading email message file
                      ifstream MsgFile(argv[4]);
                    
                      // 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: <[email protected]>
                      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: <[email protected]>
                      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();
                      system("pause");
                    
                      return 0;
                    }






                    gibs coins @
                    1KatP9B8KG7mvcoFhdLGua1isG88nYZE8C

                    Comment

                    Working...
                    X