Apzo Posted March 9, 2006 Share Posted March 9, 2006 (edited) Hello I made a set of pop3 functions, based on the pop3 RFC and the wonderfull abilities of the 3.1.1.110 au3 beta version. You will find in the zip file a sample script, and of course the library. The functions are : _pop3Connect (server, login, passwd [, port]) _Pop3Dele(msg_number) _Pop3List([msg_number]) _Pop3Noop() _Pop3Quit() _Pop3Retr(msg_number) _Pop3Rset() _Pop3Stat() _Pop3Top(msg_number, lines) _Pop3Uidl([msg_number]) I'm sure you bot coders will love it Have fun ! Apzo. [Edit] 2008, Oct 29. Thanks to Alexandre Beloin, the _pop3Disconnect() has been updated. The zip file has been updated too. [/Edit] _pop3.zip Edited October 29, 2008 by Apzo mLipok 1 All the pop3 functions.Rsync your files on your USB key (or anywhere else) Link to comment Share on other sites More sharing options...
mikeytown2 Posted March 9, 2006 Share Posted March 9, 2006 (edited) sounds cool, I'll look at it later. BTW what login method do you use? plain text? Edited March 9, 2006 by mikeytown2 Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack Link to comment Share on other sites More sharing options...
Apzo Posted March 9, 2006 Author Share Posted March 9, 2006 sounds cool, I'll look at it later. BTW what login method do you use? plain text?Plain text, yes, the good old login/pass on port 110 is still a major security hole However I'm trying to understand the APOP mechanism, it uses md5 but I don't know if my ISP currently support it.I'll tell here about new enhancements. Apzo. All the pop3 functions.Rsync your files on your USB key (or anywhere else) Link to comment Share on other sites More sharing options...
KxS Posted March 9, 2006 Share Posted March 9, 2006 Looks great, will check it out. How does it handle attachments? Link to comment Share on other sites More sharing options...
Gigglestick Posted March 9, 2006 Share Posted March 9, 2006 That's great! Can you make an IMAP one one? My UDFs: ExitCodes Link to comment Share on other sites More sharing options...
Apzo Posted March 10, 2006 Author Share Posted March 10, 2006 (edited) Looks great, will check it out.How does it handle attachments?Attachments are not part of the POP3 protocol.The mails are text encoded in the mailbox, and retrieved as text.If you need to handle attachments, I've seen a base64 UDF around here that may suit your needs.EDIT : attachments rather need a mime decoder, kinda great challenge !Some work for Mikeytown2 and Blindwig ?That's great! Can you make an IMAP one one? Why not ? It may be a great copy/paste party, but it shouldn't be difficult I'm thinking about some other protocols, such as SMTP and IRC It's easy now to code net protocols with the new net and regexp functions Apzo. Edited March 10, 2006 by Apzo All the pop3 functions.Rsync your files on your USB key (or anywhere else) Link to comment Share on other sites More sharing options...
mikeytown2 Posted March 10, 2006 Share Posted March 10, 2006 Attachments are not part of the POP3 protocol.The mails are text encoded in the mailbox, and retrieved as text.If you need to handle attachments, I've seen a base64 UDF around here that may suit your needs.Why not ? It may be a great copy/paste party, but it shouldn't be difficult I'm thinking about some other protocols, such as SMTP and IRC It's easy now to code net protocols with the new net and regexp functions Apzo.Yeah check out my sig for links to the base64 encoder/decoder. i also just updated my SMTP stuff in that same thread, so you might want to look at that as well. I modded the code from the beta Inet file for my smtp stuff.C:\program Files\AutoIt3\beta\Include\Inet.au3I also added sending email directly to the mx server in the example. Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack Link to comment Share on other sites More sharing options...
Apzo Posted March 10, 2006 Author Share Posted March 10, 2006 Yeah check out my sig for links to the base64 encoder/decoder. i also just updated my SMTP stuff in that same thread, so you might want to look at that as well. I modded the code from the beta Inet file for my smtp stuff.C:\program Files\AutoIt3\beta\Include\Inet.au3I also added sending email directly to the mx server in the example.Great job, once more But attachments need mime decode (I hope my boss didn't noticed my error)A solution is to use Munpack; I'd prefer an UDF but I couldn't find some. Apzo. All the pop3 functions.Rsync your files on your USB key (or anywhere else) Link to comment Share on other sites More sharing options...
theguy0000 Posted March 10, 2006 Share Posted March 10, 2006 SMTP and IRC would be great! The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
=sinister= Posted September 18, 2007 Share Posted September 18, 2007 Sorry to bring up such an old topic, But I really need help. It won't connect for me. I type in my info (using a gmail account) and I get an error. The @error is 9. What does that mean and how do I fix it? Link to comment Share on other sites More sharing options...
Apzo Posted October 31, 2007 Author Share Posted October 31, 2007 @ me to (also gmail), server: pop.gmail.com port: 995Gmail doensn't use the pop3 protocol !It's a web based one, like Hotmail. Apzo. All the pop3 functions.Rsync your files on your USB key (or anywhere else) Link to comment Share on other sites More sharing options...
theguy0000 Posted October 31, 2007 Share Posted October 31, 2007 Gmail doensn't use the pop3 protocol !It's a web based one, like Hotmail. Apzo.you can still use pop3 if you want...and hotmail has pop3 servers too by the way... The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
mbkowns Posted November 13, 2007 Share Posted November 13, 2007 Anything new on SSL and pop3? Link to comment Share on other sites More sharing options...
Josbe Posted November 13, 2007 Share Posted November 13, 2007 Gmail doensn't use the pop3 protocol !It's a web based one, like Hotmail. Apzo.hmm..like Hotmail maybe not.If you enable in the Settings(gmail), you can have POP and IMAP(recently added to gmail). Of course, IMAP is better. • AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
Apzo Posted November 13, 2007 Author Share Posted November 13, 2007 Anything new on SSL and pop3?http://mail.google.com/support/bin/answer.py?answer=13287Pop enabled, yes, but SSL secured Thus the IP port is not 110 but 995, and ssl encoded.So far we don't have SSL funcs in AutoIt (HELP !), maybe stunnel would help.BTW I'm still looking for Jabber doc and help : Jabber protocol (Gtalk) seems promising.Any DLL coder in touch for it yet ? Apzo. All the pop3 functions.Rsync your files on your USB key (or anywhere else) Link to comment Share on other sites More sharing options...
Alexandre Beloin Posted June 24, 2008 Share Posted June 24, 2008 Maybe useful for other: The function _Pop3Quit() send a QUIT to the server but doesn't run the function _Pop3Disconnect(), so you're never fully disconnected. A simple solution is to add _Pop3Disconnect() after _Pop3Quit() Also _Pop3Disconnect() never reset $pop3_IsConnected to zero. So even if you use _Pop3Disconnect() you'll still be unable to connect again(Error: $pop3_error_already_connected). You need to add $pop3_IsConnected = 0 just before Return 0 in the function _Pop3Disconnect(). Func _pop3Disconnect() If $pop3_IsConnected <> 0 Then TCPCloseSocket ($pop3_socket) TCPShutDown () $pop3_IsConnected = 0; Add this line to get a proper connection status Return 0 Else SetError($pop3_error_not_connected) Return -1 EndIf EndFunc ;==>_pop3Disconnect Link to comment Share on other sites More sharing options...
StAbb Posted October 14, 2008 Share Posted October 14, 2008 (edited) So this UDF will not work with SSL right? No gmail, or yahoo? Also, what POP servers work with it, I have tried several and not had a lot of success. Thanks! Edited October 14, 2008 by StAbb Link to comment Share on other sites More sharing options...
flyingboz Posted October 27, 2008 Share Posted October 27, 2008 So this UDF will not work with SSL right? No gmail, or yahoo? Also, what POP servers work with it, I have tried several and not had a lot of success.Thanks!Correct, it won't. Different reasons (unless you have a paid yahoo account).Depending on what you need, you can check out the cdo mail methodology that's commonly used around here for sending mail, if you're trying to build a reader, don't have a lot of help for you.I've written some code that at some time may be fleshed out enough involving blat and stunnel that gets me what I need for things like email logging, etc. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
ptrex Posted October 27, 2008 Share Posted October 27, 2008 @This is all you needSee 2 nd post POP SSLRegardsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Tipulatoid Posted October 28, 2008 Share Posted October 28, 2008 I wrote (with great help from MrCreatoR) e-mail parser, which may be useful for someone.It returns an Array where saved:In the 1st line - Sender's nameIn the 2nd line - Sender's addressIn the 3rd line - Recipient nameIn the 4th line - Recipient addressIn the 5th line - SubjectIn the 6th line - CharsetIn the 7th line - Message bodyIn the 8th line - Attachment's name (if exists)In the 9th line - Attachment's body (if exists)In the next pairs of lines - names and bodies of the other attachments (if exist)expandcollapse popup#include <Array.au3> #include <_pop3.au3> ; Just example Global $MyPopServer = "pop.yandex.ru" Global $MyLogin = "delta2-greit" Global $MyPasswd = "will_not_say" ; Connecting to POP3 _pop3Connect($MyPopServer, $MyLogin, $MyPasswd) If @error Then MsgBox(16, "Error. Code " & @error, "Unable to connect to " & $MyPopServer) Exit Else ConsoleWrite("Connected to server pop3 " & $MyPopServer & @CR) EndIf ; Downloading letter #1 Local $retr = _Pop3Retr(1) If Not @error Then $aParsedLetter = _ParseEmail ($retr); sends downloaded letter for parsing Else ConsoleWrite("Retr commande failed" & @CR) Exit EndIf ; Closing connection ConsoleWrite(_Pop3Quit() & @CRLF) ; End of the example _ArrayDisplay ($aParsedLetter) Func _ParseEmail ($sReadFile) Dim $aLetter[1] _AddToLetterArray (StringRegExp($sReadFile, '(?im)^From: +(.*)(?: |<)(?:.*?<|)(.*?)(?:>|)\r\n', 1), $aLetter) _AddToLetterArray (StringRegExp($sReadFile, '(?im)^To: +(.*)(?: |<)(?:.*?<|)(.*?)(?:>|)\r\n', 1), $aLetter) _AddToLetterArray (StringRegExp($sReadFile, '(?im)^Subject: +(.*)\r\n', 1), $aLetter) _AddToLetterArray (StringRegExp($sReadFile, '(?i) charset="?(.*?)(?:"|\r\n)', 1), $aLetter) $aSplit = StringSplit ($sReadFile, @CRLF, 1) $iFirstBoundaryString = _ArraySearch ($aSplit, "boundary=", 0, 0, 0, 1) $iBoundary = $aSplit[$iFirstBoundaryString] $iBoundary_startpos = StringInStr ($iBoundary, '"') $iBoundary_endpos = StringInStr ($iBoundary, '"', 0, 2) $boundary = StringMid ($iBoundary, $iBoundary_startpos+1, $iBoundary_endpos-$iBoundary_startpos-1) $boundary1 = _ArraySearch ($aSplit, $boundary, $iFirstBoundaryString+1, 0, 1, 1) $boundary2 = _ArraySearch ($aSplit, $boundary, $boundary1+1, 0, 1, 1) $message = "" $Write = False For $i=$boundary1 To $boundary2-1 If $aSplit[$i] = "" Then $Write = True If $Write = True Then $message &= $aSplit[$i] & @CRLF Next _AddToLetterArray ($message, $aLetter) _AddToLetterArray (StringRegExp($sReadFile, '(?ims) filename="?(.*?)(?:"|\r).*?\n\r\n(.*?)\r\n^-+', 3), $aLetter) Return $aLetter EndFunc; ==> _ParseEmail Func _AddToLetterArray ($aContents, ByRef $afLetter) If IsArray($aContents) Then For $t = 0 to UBound ($aContents) - 1 _ArrayAdd ($afLetter, $aContents[$t]) Next Else _ArrayAdd ($afLetter, $aContents) EndIf Return $afLetter EndFunc;==>_AddToLetterArrayAny reaction will be highly appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now