Managed Hosting



Project Home Blog Forums Known Issues Screenshots Contact Project

Author: Omar Gonzalez (All RIAForge projects by this author)
Last Updated: May 25, 2008 12:55 PM
Version: 0.1 (Alpha)
Views: 46,493
Downloads: 3,772
License: GPL (GNU General Public License)


The ASMailer class sends emails using an SMTP server. ASMailer sends mail without the need of a server side language like PHP or JSP. This project is in alpha state. Currently sends using SMTP servers that do not require authentication or SSL connection. Currently only test on default port 25.

Distribution: Right now Im distributing a SWC file for Flex and an MXP to install as a component to Flash. When I finish authentication and SSL support and finish cleaning / documenting all the code then I will put the source code files in the SVN repository.

The Alpha release of ASMailer supports multiple text emails to multiple recipients directly to an SMTP server that has a basic/default configuration. Because I have access to limited amount of SMTP mail servers, and I am not really a server guy, I have only test this class using two different servers. Both do not require authentication, or SSL connectivity, so my ability to implement those is limited, but I am working on it. If anyone can help with a connection to a mail server that requires authentication, or SSL connectivity please email me at: asmailer.support@gmail.com

To see a code example see the ASDocs, located at: http://omar.likesflex.com/projects/asmailer/docs


import com.almerblank.fl.net.mail.Email;
import com.almerblank.fl.net.mail.ASMailer;
import com.almerblank.fl.net.mail.events.MailEvent;
import com.almerblank.fl.net.mail.events.MailErrorEvent;

private var mail:ASMailer;

private function init():void
mail = new ASMailer( 'mail.yourserver.com' );
mail.addEventListener( MailEvent.SMTP_CONNECTION_READY, _connReady );
mail.addEventListener( MailEvent.SMTP_STATUS_EVENT, _handleStatus );
mail.addEventListener( MailEvent.SMTP_EMAILING_COMPLETE, _emailsComplete );
mail.addEventListener( MailEvent.SMTP_DISCONNECTED, _disconn );
mail.addEventListener( MailErrorEvent.SMTP_SERVER_ERROR, _smtpErrorHandler );
mail.addEventListener( MailErrorEvent.SMTP_IOERROR, _smtpIOError );
mail.addEventListener( MailErrorEvent.SMTP_SECURITY_ERROR, _smtpSecError );

private function _disconn( event:MailEvent ):void
trace( 'disconnected...' );

private function _emailsComplete( event:MailEvent ):void
trace( '_emailsComplete()' );

private function _smtpIOError( event:MailErrorEvent ):void
trace( 'event.message = ' + event.message );

private function _smtpSecError( event:MailErrorEvent ):void
trace( 'event.message = ' + event.message );

private function _handleStatus( event:MailEvent ):void
tf_status.text += event.status;
tf_status.text += '\n';
tf_status.verticalScrollPosition = tf_status.maxVerticalScrollPosition;

private function _smtpErrorHandler( event:MailErrorEvent ):void
trace( 'event.code = ' + event.code );
trace( 'event.message = ' + event.message );
trace( 'event.failedOnCommand = ' + event.failedOnCommand );

private function _connReady( event:MailEvent ):void

private function sendEmails():void
var lipsum1:String = '...text...';
var lipsum2:String = '...text...';

// one email send to one person
var em:Email = new Email( 'user@server.com', [ 'toUser@server.com' ], 'message 1 subject', lipsum1 );

// one email to two people
var em2:Email = new Email( 'user@server.com', [ 'toUser@server.com', 'toSecondUser@diffServer.com' ], 'message 2 subject', lipsum2 );

// send multiple in an array
mail.sendMail( [ em, em2 ] );

// send one in an array
//mail.sendMail( [ em ] );


This code should work in Flash and Flex. The init() method would start the process.

In the description for the ASMailer constructor there is a Flex code example. The code in the Script tag would work identically for Flash, except the init() method would be called somewhere else. Please post any issues you run into on the issue tracker at http://asmailer.riaforge.org so I can try to squash any bugs you run into as soon as I can. Thanks and enjoy!

ASDocs URL: http://omar.likesflex.com/projects/asmailer/docs

Recent Blog Entries:


ActionScript 3

Issue Tracker:

There are no issues for this project.

To enter issues for this (or any other) project, you must be logged in.

Subversion Access:

You may access this project's Subversion repository with your client here: http://svn.riaforge.org/asmailer.

To view files and changelists associated with this repository, go here: http://asmailer.riaforge.org/index.cfm?event=page.svnbrowse.

Anonymous users have read access to the repository while the administrator has write access.

This project is sharing its code via Subversion. Subversion is an open source source control method. You may find more information about Subversion here: http://subversion.tigris.org/