Jump to content

_pop3 gmail reacive mail?


Go to solution Solved by Insomniac420,

Recommended Posts

I'm trying to make a forum subscription responder for my pc to respond to new subscribers to my forum but the problem is the email is from the forum website and not the forum the subscriber. The forum subscribers contact address is inside the body of the email. If I can get the full body I can isolate the persons contact address and respond.

I already have the INetSmtpMailCom working for sending emails just need the contact email now.

And this func displayed works for _CheckMail but it only gets a summary of the body that does not include the portion of the email I need.

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

I considered using Outlook but decided its not worth spending near 400$ for it so I decided to try and use POP3  what ever works as long as I can get

 the whole body of the email and not just a summary.

So after doing some digging I found several attempts >POP3.eu3 UDF>example1  ,  >example2  and others but none said they worked with Gmail SSL.

 

I'm open to any ideas Thank you ahead of time for any help.

Also I am on win 7 X64 if you needed to know.

 

Link to comment
Share on other sites

  • Solution

Well I did what I needed so I used Mozilla Thunderbird mail client with pop3 settings and used it to filter the email messages with the subject I needed then it saved it to a folder on my hard drive as a readable txt. I was them able to use FileReadLine and go thru the lines tell I found the subscribers contact address, then I used INetSmtpMailCom to respond to the email. So it checks my email every 4 mins for new subscribers then responds like I wanted :D thank you for your excellent help

Edited by Insomniac420
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...