###前提・実現したいこと
SendMailクラスでcatchしたSendFailedException をACTIONに戻して
action Message("送信エラー")を表示させたい
###発生している問題・エラーメッセージ
半角ならどんなメアドでも送れてしまう
```SEndMail.java public class SendMail { /*フィールド*/ private String address; private String pwd; public SendMail(String address, String pwd) {/*コンストラクタ*/ this.address = address; this.pwd = pwd; } public int doMail(){ /*メール送信*/ try{/*start*/ //property Properties prop = new Properties(); /*接続環境指定*/ prop.put("mail.smtp.auth", "true");//認証 prop.setProperty("mail.smtp.host", "smtp.kagoya.net");//ホストサーバー設定 prop.setProperty("mail.smtp.port", "25");//ポート番号指定587でも可 /*コンソール*/ //サーバとの会話内容を出力してくれる! prop.setProperty("mail.debug", "true"); //パスワードを保持するクラスを作る必要がある? class PasswordAuthenticatior extends Authenticator{ private String username; private String password; PasswordAuthenticatior(String username, String password) { this.username = username; this.password = password; } @Override public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } } //パスワード認証つきのセッションを作成 Session session = Session.getDefaultInstance( prop, new PasswordAuthenticatior("infinitys.chinuki","infinitys") ); //送信メッセージ MimeMessage mimeMessage1 = new MimeMessage(session); //ToAddressのセット mimeMessage1.setRecipient(Message.RecipientType.TO, new InternetAddress(this.address)); //FRomAdressnoセット mimeMessage1.setFrom(new InternetAddress("chinuki@infinitys.co.jp")); new String("Subject"); mimeMessage1.setSubject("パスワード発行","iso-2022-jp");/*件名*/ new String ("Text"); mimeMessage1.setText("あなたのパスワードは" + pwd + "です","iso-2022-jp"); //保存 mimeMessage1.saveChanges(); //メールの送信 Transport.send(mimeMessage1); } catch (SendFailedException e) { /*ここの中がわからない メッセージ ”送信エラー"を表示 他はすべて送信*/ }catch(MessagingException e){/*すべての例外*/ e.printStackTrace(); return 0; } return 1; } }
###補足情報(言語/FW/ツール等のバージョンなど) ecipse javamail1.4.7

回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/12/24 00:31