开发者

Mail function in OPA

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 co开发者_运维技巧nfigure some "package" on my computer to get email working, in this case which "package" is using OPA ?


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). ??


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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜