Insomniac420 Posted August 5, 2014 Share Posted August 5, 2014 (edited) Im using _CheckMail, it works fine I use StringInStr to get the email I want to read specifically but is there any way to read the whole email because as of now I can only read a summary that does not include the portion of the email I need to read. Thank you ahead of time for any help. expandcollapse popupFunc _CheckMail($UserName, $Pswd, $UserAgentString = "") If Not $UserName Then Return SetError(2,0,0) If Not $Pswd Then Return SetError(3,0,0) If $UserAgentString Then HttpSetUserAgent($UserAgentString) Local $source = InetRead("https://" & $UserName & ":" & $Pswd & "@gmail.google.com/gmail/feed/atom",1) If @error Then ConsoleWrite("!>Error Getting URL Source!" & @CR & " 404>@Error =" & @error & @CR & " 404>@Extended =" & @extended & @CR) Return SetError(4,0,0) EndIf If $source Then $source = BinaryToString($source) Else Return SetError(5,0,0) EndIf If StringLeft(StringStripWS($source, 8), 46) == "<HTML><HEAD><TITLE>Unauthorized</TITLE></HEAD>" Then Return SetError(6, 0, 0) If Not Number(StringBetween($source, "<fullcount>", "</fullcount>")) Then Return SetError(0,0,0) Local $Email = _StringBetween($source, "<entry>", "</entry>") If @error Then Return SetError(1, 0, 0) Local $Time Local $Count = UBound($Email) Local $Datum[$Count + 1][7] $Datum[0][0] = StringBetween($source, "<title>", "</title>") $Datum[0][1] = StringBetween($source, "<tagline>", "</tagline>") For $i = 0 To $Count - 1 $Datum[$i+1][0] = StringBetween($Email[$i], "<title>", "</title>") If Not $Datum[$i+1][0] Then $Datum[$i][0] = "(no subject)" $Datum[$i+1][1] = StringBetween($Email[$i], "<name>", "</name>") $Datum[$i+1][2] = StringBetween($Email[$i], "<email>", "</email>") $Datum[$i+1][3] = StringBetween($Email[$i], "<summary>", "</summary>") $Time = StringBetween($Email[$i], "<issued>", "</issued>") $Datum[$i+1][4] = DateFromTimeDate($Time) $Datum[$i+1][5] = TimeFromTimeDate($Time) $Datum[$i+1][6] = StringBetween($Email[$i], "<form>", "</form>") Next Return SetError(0,$Count,$Datum) EndFunc Func StringBetween($Str, $S, $E) Local $B = _StringBetween($Str, $S, $E) If @error Then Return SetError(1,0,0) Return SetError(0,0,$B[0]) EndFunc Func DateFromTimeDate($String) Local $RegEx = StringRegExp($String, "(?<Year>d{2}|d{4})(?:-)(?<Month>d{1,2})(?:-)(?<Day>d{1,2})", 1) If IsArray($RegEx) Then Return Int($RegEx[0]) & "/" & Int($RegEx[1]) & "/" & Int($RegEx[2]) Else Return SetError(1, 0, 0) EndIf EndFunc Func TimeFromTimeDate($String) Local $RegEx = StringRegExp($String, "(?<Hour>d{1,2})(?::)(?<Minute>d{1,2})(?::)(?<Second>d{1,2})", 1) If IsArray($RegEx) Then Return(Int($RegEx[0]) - 4) & ":" & Int($RegEx[1]) & ":" & Int($RegEx[2]) Else Return SetError(1, 0, 0) EndIf EndFunc Edited August 5, 2014 by Insomniac420 Link to comment Share on other sites More sharing options...
water Posted August 5, 2014 Share Posted August 5, 2014 _INetSmtpMailCom is used to SEND mails. You posted a function to READ mails from GMail. Why don't you use a mail client to retrieve the mails? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Insomniac420 Posted August 5, 2014 Author Share Posted August 5, 2014 So I made a .exe that will read my email every 10 mins and check for a certain title it will read that title and if its different then the last similar title write it to a log file and pop up a msg box alerting me of the new email. Instead of it alerting me i would like it then to respond with a email. That's easy with _INetSmtpMailComi have it working already. The problem is the email I want to respond to is not the sender of the email. The contact I want to respond to is inside the actual email and the summary does not include the portion I need to read to isolate the string. If a mail client to retrieve the mails is what i need please point me the right way I googled and looked at a few and they could not do what i wanted. I was also looking at >Outlook UDF this might be my best choice if i can get it to work. But if anyone can help me with what im trying to do the help would be much appreciated. Thank you. Link to comment Share on other sites More sharing options...
water Posted August 5, 2014 Share Posted August 5, 2014 Your best choice would be my OutlookEX UDF I can assist if there are any questions. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Insomniac420 Posted August 5, 2014 Author Share Posted August 5, 2014 (edited) Ok so Water I must say thank you for the great UDF. Sadly after looking into it I noticed there is over 100 OL functions and thousands of lines of code, and after reading 20 pages from the OutlookEX UDF example page I felt very overwhelmed and thought it still might be best to ask at least what funcs from the OutlookEX udf should I use? I Could not find any good examples. to open _OL_Open("","","", "", $sProfileName, $sPassword) then check for new email I can do the rest from there I just need a good example please help I can keep looking on my own but may spend hours looking thru everything for the funcs I need hope I'm not being to lazy I'm just very overwhelmed. i think i found it sorry '?do=embed' frameborder='0' data-embedContent>> Edited August 5, 2014 by Insomniac420 Link to comment Share on other sites More sharing options...
water Posted August 5, 2014 Share Posted August 5, 2014 You only need two files: OutlookEX.au3 and OutllookEXConstants.au3. All other files are examples or help files. For every function in the UDF you'll find a function.au3 example file and a function.htm help file. When checking your mail, do you want to retrieve a list of mails with a specific subject? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Insomniac420 Posted August 5, 2014 Author Share Posted August 5, 2014 (edited) You only need two files: OutlookEX.au3 and OutllookEXConstants.au3. All other files are examples or help files. For every function in the UDF you'll find a function.au3 example file and a function.htm help file. When checking your mail, do you want to retrieve a list of mails with a specific subject? I can use Outlook to filter all messages with the subject "Notification of Subscription" then I would need to check all new emails within that folder, then save the new emails to a txt file or a variable I can do everything I need to. The closest thing I could find was '?do=embed' frameborder='0' data-embedContent>> I'm trying to make a forum subscription responder but the problem is the email is from the forum website and not the forum the subscriber. The forum subscribers email address is inside the content of the email. I already have the INetSmtpMailCom working for sending emails. _CheckMail works for reading but it can only get a summary that does not include the portion of the email I need. Edited August 6, 2014 by Insomniac420 Link to comment Share on other sites More sharing options...
water Posted August 6, 2014 Share Posted August 6, 2014 Example 4 in _OL_ItemFind.au3 should do what you want. It returns all unread mails in the specified folder plus any subfolder and returns the specified properties. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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