3

Today I need to send email in my OPA apps. Then I'am trying to use opa functions about mail.

I am using the module : stdlib.web.mail. And the OPA version :

Opa compiler (c) MLstate -- version S3.5 -- build 320

Then, with function Email.try_send it's a blocking function and this function block the client long long time... (I have never seen this function terminate....)

Then I have tried to use the function Email.try_send_async, with a "callback function" like this :

(a-> jlog(Email.string_of_send_status(a)))

I have never seen in console or on client side any error or success message... It's useless to precise that I have never got email too :(

Then my questions are :

  • Could you tell me more about this module ?
  • Why am I never getting status message ?
  • My computer is on local network, maybe I must configure some "package" on my computer to get email working, in this case which "package" is using OPA ?
Mattgu74
  • 224
  • 1
  • 6
  • Don't know much about the Email module, but the first thing I'd advice to try is to do `mlset show_logs`; or if that doesn't work then to set the env. variable `MLSTATE_SHOW_LOGS=1` and then check what you get on the console (where you run the app) and let us know -- this should hopefully help with pin-pointing the problem. – akoprowski Aug 15 '11 at 13:43
  • I'm not sure what you meant with MLSTATE_SHOw_LOGS... But I have start my server with --verbose 100 and then get these few lines : `resolve_mx: name=alt4gmail-smtp-inlgooglecom resolve_mx: name=alt3gmail-smtp-inlgooglecom resolve_mx: name=alt2gmail-smtp-inlgooglecom resolve_mx: name=alt1gmail-smtp-inlgooglecom resolve_mx: name=gmail-smtp-inlgooglecom ` But always nothing about error or success... (And I'm always not getting email in my mailbox) – Mattgu74 Aug 19 '11 at 15:41

2 Answers2

1

I did not manage to reproduce your problem. I did try with the following:

import stdlib.web.mail
from = {name=none address={local="hugo" domain="opalansdfsdforg.fr"}}
to = {name=none address={local="youremail" domain="gmail.com"}}
_ = println("===Before")
r = Email.try_send(from,to,"subject",{text="great"})
_ = println("===Status {r}")
_ = println("===After")

What do you get if you execute this code (with --verbose option). ??

hugo
  • 11
  • 1
  • ./test.exe --verbose 100 ===Before resolve_mx: name=alt4gmail-smtp-inlgooglecom resolve_mx: name=alt3gmail-smtp-inlgooglecom resolve_mx: name=alt2gmail-smtp-inlgooglecom resolve_mx: name=alt1gmail-smtp-inlgooglecom resolve_mx: name=gmail-smtp-inlgooglecom and nothing more... – Mattgu74 Aug 19 '11 at 19:05
  • `Fatal error: exception Scheduler.Empty` this is comming 10-15min later – Mattgu74 Aug 19 '11 at 20:02
0

In fact the problem was linked to my adsl box which had a security option enabled. Security option was allowing only smtp of my ISP.

Maybe you must had something to detect it, and then throw an error more verbose than nothing :)

Mattgu74
  • 224
  • 1
  • 6