2016-12-18 3 views
-1

てメールを送信し、その後errorthis私を与える私はAspose社を使用してメールを送信しようとするが、プログラムのビルドは、時間に沿ってのためにruningてされるが、私のコード確認のためのAspose

public static void main(String[] args) { 
    SmtpClient client = new SmtpClient("smtp.gmail.com", 587, "kerolos", "MyPassword"); 
    MailMessage message = new MailMessage(); 
    message.setFrom(new MailAddress("[email protected]")); 
    message.getTo().addMailAddress(new MailAddress("[email protected]")); 
    message.setBody("nothinge"); 
    message.setSubject("me"); 
    client.send(message); 
} 

ですこれは私の誤りである

Exception in thread "main" class com.aspose.email.SmtpException: Failure sending mail. ---> class com.aspose.email.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at 
5.5.1 https://support.google.com/mail/?p=WantAuthError g73sm13415755wme.16 - gsmtp 

com.aspose.email.abk.f(SourceFile:49) 
com.aspose.email.asu.n(SourceFile:130) 
com.aspose.email.cg.a(SourceFile:311) 
com.aspose.email.internal.ah.h.a(Unknown Source) 
com.aspose.email.internal.ah.j.run(Unknown Source) 
java.lang.Thread.run(Thread.java:745) 
--- End of inner exception stack trace --- 
com.aspose.email.SmtpClient.a(SourceFile:1982) 
com.aspose.email.SmtpClient.send(SourceFile:1785) 
test.mina.main(mina.java:23) 
at com.aspose.email.SmtpClient.a(SourceFile:1982) 
at com.aspose.email.SmtpClient.send(SourceFile:1785) 
at test.mina.main(mina.java:23) 
Caused by: class com.aspose.email.SmtpException: The SMTP server requires a  secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at 
5.5.1 https://support.google.com/mail/?p=WantAuthError g73sm13415755wme.16 - gsmtp 

com.aspose.email.abk.f(SourceFile:49) 
com.aspose.email.asu.n(SourceFile:130) 
com.aspose.email.cg.a(SourceFile:311) 
com.aspose.email.internal.ah.h.a(Unknown Source) 
com.aspose.email.internal.ah.j.run(Unknown Source) 
java.lang.Thread.run(Thread.java:745) 
at com.aspose.email.abk.f(SourceFile:49) 
at com.aspose.email.asu.n(SourceFile:130) 
at com.aspose.email.cg.a(SourceFile:311) 
at com.aspose.email.internal.ah.h.a(Unknown Source) 
at com.aspose.email.internal.ah.j.run(Unknown Source) 
at java.lang.Thread.run(Thread.java:745) 

Javaが返さ:1 BUILD FAILED(合計時間:35秒)

+0

デバッグヘルプ(「なぜこのコードは動作しませんか?」)には、目的の動作、特定の問題またはエラー、および質問自体に再現するのに必要な最短コードが含まれている必要があります。明確な問題文がない質問は、他の読者にとって有用ではありません。参照:[mcve]を作成する方法 –

+0

これはメールを送信するためのコードであり、これは何を私がもっと言いたいのですか? –

+1

エラーメッセージをお読みになりましたか?エラーメッセージhttps://support.google.com/mail/?p=WantAuthErrorのリンクに移動しましたか?そのポートを使用するには、TLS(暗号化)接続を確立する必要があります。 –

答えて

0

GmailはEMAIにアクセスするための厳格なルールを持っています安全性の低いアプリケーションでは安全性の低いアプリケーションでGmailアカウントにアクセスするには、メールアカウントを設定してアクセスを有効にする必要があります。 https://support.google.com/a/answer/6260879?hl=en

最後にお試しください。引き続き問題が解決しない場合は、Aspose.Email forumにお問い合わせください。

私は開発者エバンジェリストとしてAsposeを使用しています。

関連する問題