haXe Forum > Send email with Haxe/PHP?
-
Nick Sabalausky Feb 23 at 04:47
Anyone know how to send an email with Haxe/PHP? I tried 'mtwin.mail.Smtp' (v1.4) but it seems to be Haxe/Neko-only.
-
keith ashford Feb 23 at 05:17
you have to use 'magic' because its not in the language for some reason.
var to:String = "eddy@yahoo.com";
untyped __php__("$message = 'hello this is the message';$message = wordwrap($message, 70);mail($to, 'email title', $message);"); -
Philipp Klose Feb 24 at 00:43
It true, there is currently no access to the mail function via the haXe API, but you could use The haXe Magic
var message:String = "Hello"; var to:String = "foo@bar.com"; untyped __call__('mail', $to, 'title', 'message');
If you need more advanced mail features, maybe consider to write a wrapper arround an exisiting PHP-native e-mail class. -
Nick Sabalausky Feb 24 at 02:22
Thanks.
.
I'm thinking of modifying 'mtwin.mail.Smpt' to use that magic to call PEAR Mail when compiling for PHP instead of Neko (and maybe falling back on PHP's more basic mail() when PEAR Mail isn't available).
.
What is the proper procedure for submitting enhancement patches to the mtwin library? -
Nick Sabalausky Feb 26 at 05:02
I've gone ahead and made the changes and submitted a patch here:
http://code.google.com/p/haxe/issues/detail?id=88&can=1&q=reporter%3Ansetbtgnws&colspec=ID%20Type%20Status%20Priority%20Platform%20Milestone%20Owner%20Summary -
Nick Sabalausky Feb 26 at 05:02