2012-03-08 9 views
0

私のアプリケーション内から電子メールを送信するためにsmtp経由でポート465を使って自分のGmailアカウントに接続しようとしていますが、接続に失敗しました...フレックスAIRアプリケーションでSMTPMailerを使用してGmailからメールを送信

<?xml version="1.0" encoding="utf-8"?> 
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" 
        xmlns:mx="library://ns.adobe.com/flex/mx"> 
<fx:Declarations> 
    <!-- Place non-visual elements (e.g., services, value objects) here --> 
</fx:Declarations> 


<fx:Script> 
    <![CDATA[  
     import org.smtp.*; 
     import org.smtp.events.SMTPEvent; 
     import org.smtp.mailer.SMTPMailer; 
     private function sendIt():void{ 

      var host:String = "smtp.gmail.com"; 
      var port:int = 465;  
      var login:String = "[email protected]"; 
      var pass:String = "mypassword"; 

      var mailer:SMTPMailer = new SMTPMailer(host,port); 

      mailer.addEventListener(SMTPEvent.MAIL_ERROR,function(e:SMTPEvent):void{ 
      trace("error:"+e.toString());}); 

      mailer.addEventListener(SMTPEvent.AUTHENTICATED,function(e:SMTPEvent):void{ 
      trace("authent:"+e.toString());}); 

      mailer.addEventListener(SMTPEvent.BAD_SEQUENCE,function(e:SMTPEvent):void{ 
      trace("bad:"+e.toString());}); 

      mailer.addEventListener(SMTPEvent.CONNECTED,function(e:SMTPEvent):void{ 
      trace("connected:"+e.toString());}); 

      mailer.addEventListener(SMTPEvent.DISCONNECTED,function(e:SMTPEvent):void{ 
       trace("disconnected:"+e.toString());}); 

      mailer.addEventListener(SMTPEvent.MAIL_SENT,function(e:SMTPEvent):void{ 
      trace("mailsent:"+e.toString());}); 

      mailer.connect(host, port); 
      mailer.authenticate(login,pass); 


      var subject:String = "Got new MAil"; 
      var message:String = "new email using SMTPMailer"; 
      var from:String = "[email protected]"; 
      var to:String = "[email protected]"; 
      mailer.sendHTMLMail(from,to,subject,message); 
      trace(mailer.connected); 
      trace("end"); 

     } 

]]> 
</fx:Script> 
<s:Button x="281" y="146" label="Send it!" 
      click="sendIt();"/> 
</s:WindowedApplication> 

メールを送信するために接続しません!私は何を間違っているのですか?

ありがとうございます!

PS:Airxmailを使用することによって解決SMTPMailer

+0

myabeを、あなたはほとんどのcrossdomain.xmlファイルが存在しない、正しい認証情報 – mgraph

+0

を使用しています;したがって、Flashはそのサーバを直接呼び出すことはできません。しかし、私はあなたの 'ホスト'がコード内のどこにでも定義されているのを見ていないので、実際にチェックすることはできません。 – JeffryHouser

+0

@mgraphはい私はgmail.comページから同じものを使用してログインしています! – sstauross

答えて

1

:あなたはあなたの自己にメールを送っているので、http://code.google.com/p/airxmail/

+0

いくつかのコードを共有できますか?TLSEngineのシャットダウンがエラーによってトリガーされました:常に証明書を確認できません – mihau

関連する問題