0

電子メール (Yahoo、Gmail、Hotmail、AOL) のユーザー名とパスワードを認証する方法は? 電子メールを認証するための cide はどこに置くべきですか?

これは私のコードです

public class AuthMail
{
    public static void authEmail()
    {
        if(LoginDialog.t_Email.getText().isEmpty())
        {
            Util.printErrorMessage("Plase Enter an Email Address");
            JOptionPane.showMessageDialog(null, "Plase Enter an Email Address", "Error", JOptionPane.ERROR_MESSAGE);
        }
        else if(LoginDialog.p_Password.getText().isEmpty())
        {
            System.out.println("Plase Enter Your Password");
            JOptionPane.showMessageDialog(null, "Plase Enter Your Password", "Error", JOptionPane.ERROR_MESSAGE);
        }
        else if(Util.getMailType().equals("GMail"))
        {
            System.out.println("Logging...");
            System.out.println("Attempting connection to GMail...");
        }
        else if(Util.getMailType().equals("Yahoo"))
        {
           System.out.println("Logging...");
            System.out.println("Attempting connection to Yahoo...");
        }
        else if(Util.getMailType().equals("Yahoo"))
        {
            System.out.println("Logging...");
            System.out.println("Attempting connection to Hotmail...");
        }
        else if(Util.getMailType().equals("AOL"))
        {
            System.out.println("Logging...");
            System.out.println("Attempting connection to Aol...");
        }
        else if(Util.getMailType().equals("Unknown"))
        {
            System.out.println("Mail Type Unknown");
            int var1 = JOptionPane.showConfirmDialog(null, "Email Type Unknown. Did you want to try again?", "Error", JOptionPane.YES_NO_OPTION);
            if(var1 == JOptionPane.NO_OPTION)
            {
                System.exit(0);
            }
        }
    }

}

注: Util.class は自分で作成します。

4

1 に答える 1

1

ホスト、ユーザー、およびパスワードを受け取る Store.connect メソッドを使用します。ユーザー名とパスワードを収集しています。ホスト名は、「if」の各ブランチで異なります。一般的なサービスのホスト名はJavaMail FAQにあります。

于 2013-03-03T08:28:41.930 に答える