??: [haXe] mtwin mail

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

??: [haXe] mtwin mail

Vadim Atlygin

Hi Tom,

To send email to different recipients, you have to call sendMail for each of them separately. You can have all of them mentioned in To header though.

var to = '[hidden email],[hidden email]';
part.setHeader('To', to);

for (t in to.split(',')) {
Smtp.send(server, from, t, body, port, user, pass);
}


----- Исходное сообщение -----
От: tom rhodes <[hidden email]>
Отправлено: 24 апреля 2010 г. 4:42
Кому: The haXe compiler list <[hidden email]>
Тема: [haXe] mtwin mail

Hi,

2 questions, one shoudl be simple and the other i'm not really sure what to do about...

1. how can i send a mail to multiple recipients? i've tried separating with ";" and "," but mtwin.mail throws an error.

2. a site i'm working on works perfectly when i set the recipient to be any of 4 email addresses i use, plus those of various friends BUT my client uses microsoft exchange mail server and it just does not receive any generated from mtwin.mail. any ideas on this? it could be that the domain of the sent mail "[hidden email]" doesn't match the domain of the mail server. they are on the same box though. might be a boundary issue, any way i can address this and still use mtwin? code to send mail is below...

class SendMail 
{

public function new() 
{
}
public static function sendMultiPart(to:String, from:String, htmlText:String, plainText:String, subject:String, servername:String, ?port:Int, ?username:String, ?pass:String):Void
{
var p = new mtwin.mail.Part("multipart/alternative");
p.setHeader("From",from);
p.setHeader("To",to);
p.setDate();
p.setHeader("Subject",subject);
var h = p.newPart("text/html");
var t = p.newPart("text/plain");
h.setContent(htmlText);
t.setContent(plainText);
mtwin.mail.Smtp.send( servername, from, to, p.get(), port, username, pass );
}
}

cheers,

tom.

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

Re: ??: [haXe] mtwin mail

tom rhodes
thanks for that, anyone encountered issue number 2? 

2010/4/23 Vadim Atlygin <[hidden email]>

Hi Tom,

To send email to different recipients, you have to call sendMail for each of them separately. You can have all of them mentioned in To header though.

var to = '[hidden email],[hidden email]';
part.setHeader('To', to);

for (t in to.split(',')) {
Smtp.send(server, from, t, body, port, user, pass);
}


----- Исходное сообщение -----
От: tom rhodes <[hidden email]>
Отправлено: 24 апреля 2010 г. 4:42
Кому: The haXe compiler list <[hidden email]>
Тема: [haXe] mtwin mail

Hi,

2 questions, one shoudl be simple and the other i'm not really sure what to do about...

1. how can i send a mail to multiple recipients? i've tried separating with ";" and "," but mtwin.mail throws an error.

2. a site i'm working on works perfectly when i set the recipient to be any of 4 email addresses i use, plus those of various friends BUT my client uses microsoft exchange mail server and it just does not receive any generated from mtwin.mail. any ideas on this? it could be that the domain of the sent mail "[hidden email]" doesn't match the domain of the mail server. they are on the same box though. might be a boundary issue, any way i can address this and still use mtwin? code to send mail is below...

class SendMail 
{

public function new() 
{
}
public static function sendMultiPart(to:String, from:String, htmlText:String, plainText:String, subject:String, servername:String, ?port:Int, ?username:String, ?pass:String):Void
{
var p = new mtwin.mail.Part("multipart/alternative");
p.setHeader("From",from);
p.setHeader("To",to);
p.setDate();
p.setHeader("Subject",subject);
var h = p.newPart("text/html");
var t = p.newPart("text/plain");
h.setContent(htmlText);
t.setContent(plainText);
mtwin.mail.Smtp.send( servername, from, to, p.get(), port, username, pass );
}
}

cheers,

tom.


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