2017-09-15 47 views
0

我發郵件,WSO2 ESB 5.0.0錯誤WSO2發送電子郵件時,ESB

1.我已經註釋掉在Axis2.xml以下行文件

<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender"> 
     <parameter name="mail.smtp.host">smtp.gmail.com</parameter> 
     <parameter name="mail.smtp.port">587</parameter> 
     <parameter name="mail.smtp.starttls.enable">true</parameter> 
     <parameter name="mail.smtp.auth">true</parameter> 
     <parameter name="mail.smtp.user">lmphuong</parameter> 
     <parameter name="mail.smtp.password">password</parameter> 
     <parameter name="mail.smtp.from">[email protected]</parameter> 
    </transportSender> 

<transportReceiver name="mailto" class="org.apache.axis2.transport.mail.MailTransportListener"> 
     <!-- configure any optional POP3/IMAP properties 
     check com.sun.mail.pop3 and com.sun.mail.imap package documentation for more details--> 
    </transportReceiver> 

2.新增內容在axis2.xml messageFormatters

<messageFormatter contentType="text/html" class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/> 

3.我已創建的WSO代理服務2 ESB

<?xml version="1.0" encoding="UTF-8"?> 
<proxy xmlns="http://ws.apache.org/ns/synapse" 
     name="EmailSender" 
     transports="http https" 
     startOnLoad="true"> 
    <description/> 
    <target> 
     <inSequence> 
     <log/> 
     <property name="messageType" 
        value="text/html" 
        scope="axis2" 
        type="STRING"/> 
     <property name="ContentType" value="text/html" scope="axis2"/> 
     <property name="Subject" value="Testing ESB" scope="transport"/> 
     <property name="OUT_ONLY" value="true"/> 
     <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/> 
     <payloadFactory media-type="xml"> 
      <format> 
       <ns:text xmlns:ns="http://ws.apache.org/commons/ns/payload">$1</ns:text> 
      </format> 
      <args> 
       <arg value="Hello WSO2 ESB.....!"/> 
      </args> 
     </payloadFactory> 
     <log level="full"/> 
     <send> 
      <endpoint> 
       <address uri="mailto:[email protected]"/> 
      </endpoint> 
     </send> 
     </inSequence> 
     <outSequence/> 
    </target> 
</proxy> 

4.我收到錯誤

ERROR - MailTransportSender Error creating mail message or sending it to the configured server 
javax.mail.AuthenticationFailedException 
     at javax.mail.Service.connect(Service.java:306)   
...  
[2017-09-15 08:04:05,945] ERROR - MailTransportSender Error generating mail message  
... 

請幫我如何soved這個錯誤

回答

0

看起來there's出錯了憑證(AuthenticationFailedException) 。你的憑證中是否有任何特殊字符?或者在esb和gmail之間是否有代理服務器?

你可以做的是在debug/enable wire log中啓動esb來查看完整的流量。更多信息可以在這裏找到。

https://docs.wso2.com/display/ESB500/Debugging+Mediation#DebuggingMediation-Viewingwirelogs

另一種選擇可能是使用Gmail的連接器,可以在這裏找到。

https://docs.wso2.com/display/ESBCONNECTORS/Gmail+Connector https://store.wso2.com/store/pages/top-assets?q=%22_default%22%3A%22gmail%22