Are there any email functions or library's available in free-pascal?
Are there any email functions or library's available in free-pascal?
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
There are currently 1 users browsing this thread. (0 members and 1 guests)