1
votes

I use WSO2 EI to send an email but I get an error message below.

2019-01-24 17:53:12,353 To: /services/SimpleProxy2.SimpleProxy2HttpSoap12Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:06891289-318c-49b1-83bd-bc71c7590078, Direction: request, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Unexpected error during sending message out, Envelope: Hello WSO2.....!
2019-01-24 17:53:12,347 Suspending endpoint : AnonymousEndpoint with address mailto:[email protected] - current suspend duration is : 30000ms - Next retry after : Thu Jan 24 17:53:42 CST 2019
2019-01-24 17:53:12,347 Endpoint : AnonymousEndpoint with address mailto:[email protected] will be marked SUSPENDED as it failed
2019-01-24 17:53:12,308 Unexpected error during sending message out 2019-01-24 17:53:12,302 Error generating mail message
2019-01-24 17:53:12,284 Error creating mail message or sending it to the configured server
2019-01-24 17:51:26,988 Unable to sendViaPost to url[http://asqi-vm:8280/services/SimpleProxy2.SimpleProxy2HttpSoap12Endpoint]
2019-01-24 17:50:27,008 This engine will expire all callbacks after GLOBAL_TIMEOUT: 1200 seconds, irrespective of the timeout action, after the specified or optional timeout
2019-01-24 17:50:26,990 To: /services/SimpleProxy2.SimpleProxy2HttpSoap12Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:06891289-318c-49b1-83bd-bc71c7590078, Direction: request, Envelope: Hello WSO2.....!

configuration file setting in EI_HOME\conf\axis2\axis2.xml

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

My proxy service code in EI

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="SimpleProxy2"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <property name="messageType"
                   scope="axis2"
                   type="STRING"
                   value="text/html"/>
         <property name="ContentType" scope="axis2" value="text/html"/>
         <property name="Subject" scope="transport" value="Testing ESB"/>
         <property name="OUT_ONLY" value="true"/>
         <property name="FORCE_SC_ACCEPTED" scope="axis2" value="true"/>
         <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.....!"/>
            </args>
         </payloadFactory>
         <log level="full"/>
         <send>
            <endpoint>
               <address uri="mailto:[email protected]"/>
            </endpoint>
         </send>
         <log level="full"/>
      </inSequence>
      <outSequence>
      </outSequence>
   </target>
   <description/>
</proxy>

I expected I can use WSO2 EI to send an e-mail and receive an e-mail.

1
I have tested your proxy service on WSO2 EI 6.1.1 and it's working as expected. Have you tried the given answer below by @Shanka?Chanuka Ranaba

1 Answers

3
votes

If you can refer to the documentation in [1] we can observe the following sample configuration for the mail transport

<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">synapse.demo.0</parameter>
    <parameter name="mail.smtp.password">mailpassword</parameter>
    <parameter name="mail.smtp.from">[email protected]</parameter>
</transportSender>

Please refer to the following parameters in your configuration. In the following can you please modify the smtp.user value to xxxxx (synapse.demo.0 in above) rather than [email protected]

<parameter name="mail.smtp.user">[email protected]</parameter>
 <parameter name="mail.smtp.from">[email protected]</parameter>

[1]-https://docs.wso2.com/display/EI640/MailTo+Transport