curl hangs

I can’t figure out what’s happening, my program hangs when it hits the c.perform. In the debugger it goes blank and no longer shows the source code.

Here’s the code:

dim e as new CURLEmailMBS

e.SMTPPassword = csBulkEmailSMTPPassword 'Session.csBulkEmailSMTPPassword
e.SMTPUsername = csBulkMailSMTPUserID
e.SetServer csBulkMailSMTPServer, true
'
LoadEmails
For Each email As String In msEmailAddress
?e.AddTo email, ""
Next

e.SetFrom "membership@aspe.org", "ASPE Membership Department"
e.Subject ="Registration for - " + rs.Field("lastName").StringValue + ", " + rs.Field("firstName").StringValue + " " + rs.Field("middle").StringValue
e.HTMLText = CreateMsg()
e.AddHeader "X-Mailer, ASPE Event Registration"
If e.HTMLText = "" then Return

dim c as new CURLSMBS
if c.SetupEmail(e) then

?dim er as Integer = c.Perform

?dim d as string = c.DebugData
?System.DebugLog (d)

?if er <>0 then
??MsgBox "Email error: " + c.LasterrorMessage
?end if
end if

Any ideas?

Rich

c.Perform is probably synchronous and so you have to wait - as does the debugger & the IDE - for that call to complete

It just hangs, I’ve used this before with no such problem.

network reachability ?
mail server reachability ?
security settings ?

  • any one of another million things that could be wrong *
    the call is synchronous so if something makes it take a long time to return then you wait until it returns - as does the IDE & debugger

Let me check…

  1. You can use CreateMTDebugOutputFile(file as folderitem) as Boolean function to write log file live. So you may see what happens.
  2. Check your firewall. If it waits 2 minutes, that is a TCP/IP timeout. My router has a white list of smtp servers.
  3. Try falls for e.SetServer SSL parameter. For TLS, this must be false.
  4. e.AddHeader needs a ": ", not a ", " as delimiter between key and value.

How do you use CreateMTDebugOutputFile. What is that a method of?

You call it before you call Perform:

dim LogFile as folderItem = getfolderitem("curl.log") dim r as boolean = b. CreateMTDebugOutputFile(LogFile)

You’re not using a Cisco router that was recently updated?
https://twitter.com/RedTeamPT/status/1110843396657238016

@Christian Schmitz

[quote]dim LogFile as folderItem = getfolderitem(“curl.log”)
dim r as boolean = b. CreateMTDebugOutputFile(LogFile)[/quote]

What is b?

your Curl object.

@Christian Schmitz

Here’s what I did:


dim LogFile as folderItem = getfolderitem("curl.log")

dim c as new CURLSMBS
dim r as boolean = c.CreateMTDebugOutputFile(LogFile)
if c.SetupEmail(e) then

    dim er as Integer = c.Perform
   if er <>0 then
       MsgBox "Email error: " + c.LasterrorMessage
   end if
end if

The curl.log is empty. Nothing in it.

Still hangs?
What is URL used?

You could email me a test project.

Are code signing your application? When was the last time you restarted your computer?

@Christian Schmitz

I’m emailing you a test project.

Well, I get in the log:

Trying 209.173.141.223... TCP_NODELAY set Connection timed out after 10002 milliseconds Closing connection 0

To test I changed:

e.SetServer "express-relay.jangosmtp.net", False

to use false and try TLS. and later I set a few options:

c.OptionPort = 2525 // 587 c.OptionTimeOut = 20 c.OptionConnectionTimeout = 10 c.OptionUseSSL = 3 // required

I always get timeouts. Is this IP okay for all locations? Or does firewall block non-US connections?

and

e.AddHeader  "X-Mailer: ASPE Event Registration"

as leader must have :

I played around and got it to work with these changes:

c.OptionSSLVersion = 6 // TLS
c.OptionUseSSL = 3 // require encrypted connection
c.OptionLoginOptions = “AUTH=LOGIN”
c.OptionPort = 2525
c.OptionTimeOutMS = 60000

Thanks! I think I need to create an obj that has all this. Just not sure how.

Thanks again.

IN a web app you may also set c.YieldTime = 1 and c.OptionConnectionTimeout = 10