Posts Tagged ‘AIR2’

AIR1.5

Additional requirements
as3crypto library

import com.coltware.airxmail.INetAddress;
import com.coltware.airxmail.MailSender.SMTPSender;
import com.coltware.airxmail.MimeMessage;
import com.coltware.airxmail.RecipientType;
// (Option) If you use TLSSocket
import com.hurlant.crypto.tls.TLSSocket;


private function send_plain_email():void{
	//  How to send plain text email
	var sender:SMTPSender = new SMTPSender();
	sender.setParameter(SMTPSender.HOST,"smtp.gmail.com");
	sender.setParameter(SMTPSender.PORT,465);  // default port is 25
	// If you use SMTP-AUTH
	sender.setParameter(SMTPSender.AUTH,true);
	sender.setParameter(SMTPSender.USERNAME,"username");
	sender.setParameter(SMTPSender.PASSWORD,"password");
	
	// If you use TLS/SSL
        // you can get as3crypto at http://code.google.com/p/as3crypto/
	var tlssocket:TLSSocket = new TLSSocket();
	sender.setParameter(SMTPSender.SOCKET_OBJECT,tlssocket);
	
	// Create email message
	var message:MimeMessage = new MimeMessage();
	
	//	Set from email address and reciepients
	var from:INetAddress = new INetAddress("from-email-address@xxxx.yyyy","from label");
	message.setFrom(from);
	
	var toRecpt:INetAddress = new INetAddress("to-email-address@xxxx.yyyy","to label");
	message.addRcpt(RecipientType.TO,toRecpt);
	
	var ccRecpt:INetAddress = new INetAddress("cc-email-address@xxxx.yyyy","cc label");
	message.addRcpt(RecipientType.CC,ccRecpt);
	
	//  
	message.setSubject("hello world");
	message.setTextBody("welcom !! \r\n this is first email. ");
	
	sender.send(message);
	sender.close(); 
}
Point
import com.hurlant.crypto.tls.TLSSocket;
:
var tlssocket:TLSSocket = new TLSSocket();
sender.setParameter(SMTPSender.SOCKET_OBJECT,tlssocket);
:

AIR2

Additional requirements

None

Point
import flash.net.SecureSocket;
:
sender.setParameter(SMTPSender.SOCKET_OBJECT,new SecureSocket());
:
RSS
Add to Google
2017年1月
« 2月    
1234567
891011121314
15161718192021
22232425262728
293031