How to send emails (php target)

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

How to send emails (php target)

Symphonicmind
Hi guys.
Well I just started my first haxe web app with php target.
So my question is, How to send an email? 

Thanks

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

Benjamin Dasnois
Hi mister Symphonic!

There's nothing in the haXe Std classes to send emails. If you're only targeting PHP then you may want to use some magic such as __php__ or __call__ and then use php's functions.

Regards,

On Sun, Nov 6, 2011 at 2:10 AM, Symphonicmind <[hidden email]> wrote:
Hi guys.
Well I just started my first haxe web app with php target.
So my question is, How to send an email? 

Thanks

--
haXe - an open source web programming language
http://haxe.org



--
DASNOIS Benjamin
http://www.benjamindasnois.com

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

Symphonicmind
I just found the mtwin.mail.Smtp (http://haxe.org/com/libs/mtwin/mtwin_mail/mtwin_mail_smtp?lang=en)
Has anyone used that with success?

On Sat, Nov 5, 2011 at 8:08 PM, Benjamin Dasnois <[hidden email]> wrote:
Hi mister Symphonic!

There's nothing in the haXe Std classes to send emails. If you're only targeting PHP then you may want to use some magic such as __php__ or __call__ and then use php's functions.

Regards,

On Sun, Nov 6, 2011 at 2:10 AM, Symphonicmind <[hidden email]> wrote:
Hi guys.
Well I just started my first haxe web app with php target.
So my question is, How to send an email? 

Thanks

--
haXe - an open source web programming language
http://haxe.org



--
DASNOIS Benjamin
http://www.benjamindasnois.com

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

Benjamin Dasnois
I think the guys at motion-twins did use it indeed but I'm not sure it would work with the latest version of haXe... I can't say.

Also, I'm not sure that it's supposed to work when targeting PHP. Maybe Nicolas can tell us more about it?

On Sun, Nov 6, 2011 at 3:33 AM, Symphonicmind <[hidden email]> wrote:
I just found the mtwin.mail.Smtp (http://haxe.org/com/libs/mtwin/mtwin_mail/mtwin_mail_smtp?lang=en)
Has anyone used that with success?


On Sat, Nov 5, 2011 at 8:08 PM, Benjamin Dasnois <[hidden email]> wrote:
Hi mister Symphonic!

There's nothing in the haXe Std classes to send emails. If you're only targeting PHP then you may want to use some magic such as __php__ or __call__ and then use php's functions.

Regards,

On Sun, Nov 6, 2011 at 2:10 AM, Symphonicmind <[hidden email]> wrote:
Hi guys.
Well I just started my first haxe web app with php target.
So my question is, How to send an email? 

Thanks

--
haXe - an open source web programming language
http://haxe.org



--
DASNOIS Benjamin
http://www.benjamindasnois.com

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org



--
DASNOIS Benjamin
http://www.benjamindasnois.com

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

MarcWeber
In reply to this post by Symphonicmind
For simple mails just call mail(to,subj,body,..) of PHP.

For complex mails you may either use Swift or port Swift to HaXe.
Swift should handle HTML, encodings etc nicely.

Marc Weber

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

Symphonicmind
sorry but I cant find that function. which class and/or namespace? (the one for simple email)
Thanks

On Sat, Nov 5, 2011 at 10:19 PM, Marc Weber <[hidden email]> wrote:
For simple mails just call mail(to,subj,body,..) of PHP.

For complex mails you may either use Swift or port Swift to HaXe.
Swift should handle HTML, encodings etc nicely.

Marc Weber

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

MarcWeber
Excerpts from Symphonicmind's message of Sun Nov 06 05:27:49 +0100 2011:
> sorry but I cant find that function. which class and/or namespace? (the one
> for simple email)
mind the "of PHP"
-> http://php.net/mail

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

Adrian Cowan
An example of just using a direct call to the php mail function would be:
untyped __php__("try {");
untyped __call__('mail', emailAddress, subject, message);
untyped __php__("} catch (Exception $e){");
//... might want to put some message or logging stuff in here...
untyped __php__("}");

Best,
Othrayte

On Sun, Nov 6, 2011 at 3:33 PM, Marc Weber <[hidden email]> wrote:
Excerpts from Symphonicmind's message of Sun Nov 06 05:27:49 +0100 2011:
> sorry but I cant find that function. which class and/or namespace? (the one
> for simple email)
mind the "of PHP"
-> http://php.net/mail

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

Nicolas Cannasse
In reply to this post by Benjamin Dasnois
Le 06/11/2011 03:39, Benjamin Dasnois a écrit :
> I think the guys at motion-twins did use it indeed but I'm not sure it
> would work with the latest version of haXe... I can't say.
>
> Also, I'm not sure that it's supposed to work when targeting PHP. Maybe
> Nicolas can tell us more about it?

Never tried on PHP, and I'm not the once maintaining this part of the lib.

@Franco : I think that adding standard PHP mail() function to php.Lib or
something else could be useful.

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

MarcWeber
In reply to this post by Adrian Cowan
Excerpts from Adrian Cowan's message of Sun Nov 06 05:42:52 +0100 2011:
> An example of just using a direct call to the php mail function would be:
> untyped __php__("try {");
> untyped __call__('mail', emailAddress, subject, message);
> untyped __php__("} catch (Exception $e){");
> //... might want to put some message or logging stuff in here...
> untyped __php__("}");

Note that mail() rarely throws exception. You should check return code -
and this often fails to indicate errors as well - so do a manual check
once.

Marc Weber

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

tom rhodes
this worked for me a whiel back (may 2010) you might want to give something like this a try...

var name = "name";
var surname = "surname";
var email = "email";
var msg = "message";
var from = email;
var to = "[hidden email]";
var subject = "Messaggio dal sito";
var htmlMail = "<html><p>Avete appena ricevuta un messaggio da " + name + " " + surname + ".</p>";
htmlMail += "<p><b>Messaggio:</b> " + msg + "</p></html>";
var plainMail = "Avete appena ricevuta un messaggio da " + name + " " + surname + ".\n\n";
plainMail += "Messaggio: " + msg + "\n";
var server = "****.****.**";
var username = "username";
var pass = "password";
var por = 26;
SendMail.sendMultiPart(to, from, htmlMail, plainMail, subject, server, port, username, pass);

On 6 November 2011 11:06, Marc Weber <[hidden email]> wrote:
Excerpts from Adrian Cowan's message of Sun Nov 06 05:42:52 +0100 2011:
> An example of just using a direct call to the php mail function would be:
> untyped __php__("try {");
> untyped __call__('mail', emailAddress, subject, message);
> untyped __php__("} catch (Exception $e){");
> //... might want to put some message or logging stuff in here...
> untyped __php__("}");

Note that mail() rarely throws exception. You should check return code -
and this often fails to indicate errors as well - so do a manual check
once.

Marc Weber

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

postite
In reply to this post by MarcWeber
you can take a look a haxigniter phpmailer extern class

you can use it this way :

import haxigniter.server.external.PHPMailer;

public function new(){
untyped __call__('require_once', configuration.externalPath + 'phpmailer/class.phpmailer.php'); 
}

public function mail() : Void {
var Xcontent= php.Web.getParams().get("contenu");
var mail= new PHPMailer(true);
mail.IsSMTP();
mail.IsHTML(true);
mail.Host="ssl://smtp.gmail.com"; //your smtp server
mail.Username="[hidden email]"; //your mail
mail.Password="xxxxxx"; /your pass
mail.Body=Xcontent; // the body of the mail
mail.CharSet="utf-8";
mail.Port=465;
mail.SMTPAuth=true;
mail.From=php.Web.getParams().get("courriel"); // additionnal parameter
mail.FromName=php.Web.getParams().get("signature"); // additional parameter

mail.AddAddress("[hidden email]");  // the mail you want to send to
mail.AddAddress("[hidden email]"); // the sender // you
mail.Subject="testfrommail"; // the subject

Lib.print(mail.Send());
}

you have to include the class.phpmailer.php in your www path....
http://sourceforge.net/projects/phpmailer/ 

it works for me


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

Tarwin Stroh-Spijer
Generally just calling "mail" using untyped __call__("mail", $var1, $var2); will work great. There's a mail class in Poko that works pretty well too, especially when you're on a windows environment. It's called EmailForwarder I think. If you're on Windows it's hard to get "mail" working at all so this just hits an externally hosted file to do the send. Good for testing.

The motion-twin email stuff can work with PHP, at least for making multipart emails, though it needs a bit of hacking to get working properly. It is quite broken.

Hope that helps.


Tarwin Stroh-Spijer
_______________________

Touch My Pixel
http://www.touchmypixel.com/
phone: +61 3 8060 5321
_______________________


On Sun, Nov 6, 2011 at 3:15 AM, postite <[hidden email]> wrote:
you can take a look a haxigniter phpmailer extern class

you can use it this way :

import haxigniter.server.external.PHPMailer;

public function new(){
untyped __call__('require_once', configuration.externalPath + 'phpmailer/class.phpmailer.php'); 
}

public function mail() : Void {
var Xcontent= php.Web.getParams().get("contenu");
var mail= new PHPMailer(true);
mail.IsSMTP();
mail.IsHTML(true);
mail.Host="ssl://smtp.gmail.com"; //your smtp server
mail.Username="[hidden email]"; //your mail
mail.Password="xxxxxx"; /your pass
mail.Body=Xcontent; // the body of the mail
mail.CharSet="utf-8";
mail.Port=465;
mail.SMTPAuth=true;
mail.From=php.Web.getParams().get("courriel"); // additionnal parameter
mail.FromName=php.Web.getParams().get("signature"); // additional parameter

mail.AddAddress("[hidden email]");  // the mail you want to send to
mail.AddAddress("[hidden email]"); // the sender // you
mail.Subject="testfrommail"; // the subject

Lib.print(mail.Send());
}

you have to include the class.phpmailer.php in your www path....

it works for me


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How to send emails (php target)

Symphonicmind
In reply to this post by postite
hey, this looks just what I need.
I know about external classes, as far as I know is like an interface and the implementation is in the .js, .php or .swf, depending on the target,
But I really cant figure what is "configuration.externalPath"
I have never used external classes =S

On Sun, Nov 6, 2011 at 5:15 AM, postite <[hidden email]> wrote:
you can take a look a haxigniter phpmailer extern class

you can use it this way :

import haxigniter.server.external.PHPMailer;

public function new(){
untyped __call__('require_once', configuration.externalPath + 'phpmailer/class.phpmailer.php'); 
}

public function mail() : Void {
var Xcontent= php.Web.getParams().get("contenu");
var mail= new PHPMailer(true);
mail.IsSMTP();
mail.IsHTML(true);
mail.Host="ssl://smtp.gmail.com"; //your smtp server
mail.Username="[hidden email]"; //your mail
mail.Password="xxxxxx"; /your pass
mail.Body=Xcontent; // the body of the mail
mail.CharSet="utf-8";
mail.Port=465;
mail.SMTPAuth=true;
mail.From=php.Web.getParams().get("courriel"); // additionnal parameter
mail.FromName=php.Web.getParams().get("signature"); // additional parameter

mail.AddAddress("[hidden email]");  // the mail you want to send to
mail.AddAddress("[hidden email]"); // the sender // you
mail.Subject="testfrommail"; // the subject

Lib.print(mail.Send());
}

you have to include the class.phpmailer.php in your www path....

it works for me


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org