Jump to content
Sign in to follow this  
Insomniac420

_INetSmtpMailCom

Recommended Posts

Insomniac420

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.

Func _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 by Insomniac420

Share this post


Link to post
Share on other sites
water

_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 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Insomniac420

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.

Share this post


Link to post
Share on other sites
water

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 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Insomniac420

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 by Insomniac420

Share this post


Link to post
Share on other sites
water

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 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Insomniac420

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 by Insomniac420

Share this post


Link to post
Share on other sites
water

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 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×