0

如何验证电子邮件(Yahoo、Gmail、Hotmail 和 AOL)的用户名和密码?应该把 cide 到 auth 电子邮件放在哪里?

这是我的代码

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 回答