Thursday, July 18, 2013

Why do we get "Failed Sending Email org.apache.axis2.AxisFault: The system cannot infer the transport information from the mailto" issue?


Most of the time in WSO2 Carbon products, users may encounter exceptions as follow when subscribing for a particular mail response:


[2013-07-17 09:49:45,781] ERROR {org.apache.axis2.description.ClientUtils} - The system cannot infer the transport information from the mailto:<email> URL.
Failed Sending Email
org.apache.axis2.AxisFault: The system cannot infer the transport information from the mailto : <email>

 at org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:81)
        at org.apache.axis2.client.OperationClient.prepareMessageContext(OperationClient.java:288)
        at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:249)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
        at org.apache.axis2.client.ServiceClient.fireAndForget(ServiceClient.java:511)
        at org.apache.axis2.client.ServiceClient.fireAndForget(ServiceClient.java:488)
        at org.wso2.carbon.email.verification.util.EmailSender.run(EmailSender.java:115)
[2013-07-17 09:49:46,079] DEBUG {org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager} - Authorization cache entry is not found for username

The reason can be :

The reason for this issue is the AxisConfiguration which uses to send this message does not have the mail transport. In axis2.xml you have to define the transportSender as below.

<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
        <parameter name="mail.smtp.from">user@gmail.com</parameter>
        <parameter name="mail.smtp.user">user</parameter>
        <parameter name="mail.smtp.password">mailpassword</parameter>
        <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>
</transportSender> 


Sometimes having an unnecessary space in between these values might also be a reason for this issue.