WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Postie

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Read Email SSL

 Keywords: READ Email POP POP3 IMAP SSL Gmail kGetMail 

Question:

kGetMail gives connection error when trying to connect to imap.gmail.com. Any ideas or has someone a working example?

Answer:

[UPDATE] In Postie Extender version 44044
Added a sixth optional 'connection security' string parameter to the kInit function. If specified, this optional parameter causes the extender to use either the Transport Layer Security (TLS) or its predecessor, the Secure Sockets Layer (SSL), cryptographic protocol for privacy and authentication when communicating with an SMTP, POP3, or IMAP server. The parameter accepts a blank string (""), "ssl", or "tls" as a value. For most servers you can use "tls" when you need to securely connect to a server. The "ssl" option is provide for compatibly with legacy server implementations that may not support the newer TLS protocol. A blank string is equivalent to omitting the parameter entirely and indicates that no TLS or SSL protocol is to be used with the connection. In most cases you will not need to specify a port number in the function's fifth parameter when using "tls" or "ssl" as the extender automatically uses the default TLS or SSL port for both sending and receiving email.


Gmail requires the use of SSL and older versions of the Postie extender don't support SSL.

However there is a third party ActiveX control from Chilkat that allows you to script reading email using SSL. http://www.chilkatsoft.com/Email-ActiveX.asp

If you purchase and install their Email ActiveX tool then the the WIL code would look something like this:


; Chilkat ActiveX Email
; http://www.chilkatsoft.com/Email-ActiveX.asp

; The mailman object is used for receiving (POP3) and sending (SMTP) email.
mailman = CreateObject("Chilkat.MailMan2")

; Any string argument automatically begins the 30-day trial.
success = mailman.UnlockComponent("30-day trial")
If success <> 1 Then
    Pause('Notice','Component unlock failed')
    Exit
EndIf

; Set the GMail account POP3 properties.
mailman.MailHost = "pop.gmail.com"
mailman.PopUsername = "****"
mailman.PopPassword = "****"
mailman.PopSsl = 1
mailman.MailPort = 995

; Read mail headers and one line of the body.
; To get the full emails, call CopyMail instead (no arguments)
bundle = mailman.GetAllHeaders(1)
For i = 0 To bundle.MessageCount - 1
    email = bundle.GetEmail(i)
    ; Display the From email address and the subject.
    from = email.From
    subject = email.Subject
    Pause(From, Subject)
    email = 0
Next

mailman = 0
Exit

Article ID:   W17596
Filename:   Read Email SSL.txt
File Created: 2012:06:06:14:13:52
Last Updated: 2012:06:06:14:13:52