Results 1 to 3 of 3

Thread: Email

  1. #1
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default Email

    Are there any email functions or library's available in free-pascal?

  2. #2
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default

    Quote Originally Posted by xdarkshadowx View Post
    Are there any email functions or library's available in free-pascal?
    AFAIK; Not built in simba, a workaround would be to host a .php mailscript and then using the 'AddPostVariable' and 'PostHTTPPageEx' methods in Simba to send the email from the website

    Forum account issues? Please send me a PM

  3. #3
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    It is built into Simba. You can also use a library called Synapse or Indy for FreePascal/Lazarus. I believe Simba uses Synapse internally.. But it is possible to send an email via Simba. Just need knowledge of Sockets and the mail header..


    This is as far as I could get.. I cannot figure out how to login with Simba.. There's very little documentation on the AUTH command through sockets and almost none for Simba's Sockets. Maybe someone else will shed some light..

    I somehow got further with Hotmail than with Gmail.. I got it working in C++ using Winsocks (took forever!!).. Just can't do it in Simba :l


    Simba Code:
    Procedure SendSocketEx(Socket: Integer; Message: String);
    begin
      SendSocket(Socket, Message + #13#10);
    end;

    Procedure SendEmail(UserName, Password, IP, Port, YourIP: String);
    var
      Socket: Integer;
    Begin
      Socket := CreateSocket;
      ConnectSocket(Socket, IP, Port);
      SetTimeout(Socket, 10000);
      SocketInfo(Socket, IP, Port);

      writeln('Connected to: ' + IP + ' Port: ' + Port);
      writeln(RecvSocket(Socket));

      SendSocketEx(Socket, 'HELO');
      writeln(RecvSocket(Socket));

      SendSocketEx(Socket, 'STARTTLS');
      writeln(RecvSocket(Socket));

      SendSocketEx(Socket, 'MAIL FROM: <mehwtfbleh@hotmail.com>');
      writeln(RecvSocket(Socket));

      SendSocketEx(Socket, 'VRFY <mehwtfbleh@hotmail.com>');
      writeln(RecvSocket(Socket));

      SendSocketEx(Socket, 'RCPT TO: <mehwtfbleh@hotmail.com>');
      writeln(RecvSocket(Socket));

      SendSocket(Socket, 'DATA' + #13#10 + '.' + #13#10);
      writeln(RecvSocket(Socket));

      SendSocketEx(Socket, 'This Is The Body..');
      writeln(RecvSocket(Socket));

      SendSocketEx(Socket, 'QUIT');
      writeln(RecvSocket(Socket));

      CloseSocket(Socket);
      FreeSocket(Socket);
    End;

    begin
      ClearDebug;
      SendEmail('', '', 'smtp.live.com', '25', 'localhost');
    end.

    And the above will print (throws exception when sending "DATA" string:

    Progress Report:
    Connected to: 65.55.172.254 Port: 25
    220 BLU0-SMTP43.blu0.hotmail.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.4675 ready at  Mon, 31 Dec 2012 20:10:29 -0800 
    
    250 BLU0-SMTP43.blu0.hotmail.com Hello [50.100.44.155]
    
    220 2.0.0 SMTP server ready
    
    Exception: Socket Error 10054: Connection reset by peer
    Socket[0] has not been freed in the script, freeing it now.



    Same for google:

    Simba Code:
    SendEmail('', '', 'smtp.gmail.com', '587', 'localhost');

    Progress Report:
    Connected to: 74.125.133.109 Port: 587
    220 mx.google.com ESMTP uz1sm35049381igb.16
    
    250 mx.google.com at your service
    
    220 2.0.0 Ready to start TLS
    
    Exception: Socket Error 10054: Connection reset by peer
    Last edited by Brandon; 01-01-2013 at 04:15 AM.
    I am Ggzz..
    Hackintosher

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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