使用Mule CE 3.5.0中的java发送电子邮件

使用Mule CE 3.5.0中的java发送电子邮件,java,email,mule,esb,Java,Email,Mule,Esb,我正在尝试使用java在Mule CE中发送电子邮件,以解决我遇到的问题: 一,。我想从这个json文件中获取收件人的电子邮件,我不知道怎么做。 2.在“我发布我的尝试”下: Xml文件: 错误: 请帮忙。提前感谢您。问题在于您使用的是Java类,并且在类中使用了public static void mainString[]args,这就是它失败并且无法找到要调用的方法的原因 与使用Java文件并使其复杂化不同,您可以简单地使用smtp外绑定,如下所示,并设置有效负载:- <set-pay

我正在尝试使用java在Mule CE中发送电子邮件,以解决我遇到的问题:

一,。我想从这个json文件中获取收件人的电子邮件,我不知道怎么做。 2.在“我发布我的尝试”下: Xml文件:

错误:


请帮忙。提前感谢您。

问题在于您使用的是Java类,并且在类中使用了public static void mainString[]args,这就是它失败并且无法找到要调用的方法的原因

与使用Java文件并使其复杂化不同,您可以简单地使用smtp外绑定,如下所示,并设置有效负载:-

<set-payload value="Dear Mail Crawler,
                    \n\n No spam to my email, please!" doc:name="Set Payload"/>

<smtp:outbound-endpoint host="smtp.gmail.com" port="587" 
    user="myemail%40gmail.com" password="pass" to= "#[message.payload.email]"
    from="Rajeun" subject="Testing Subject" responseTimeout="10000" connector-ref="Gmail" doc:name="Send notification email"/>
然后在使用connector ref=Gmail和smtp出站的流中使用以下内容,如下所示:-

  <smtp:outbound-endpoint host="smtp.gmail.com"  port="587" responseTimeout="10000" doc:name="SMTP" connector-ref="Gmail" from="Rajeun" password="pass" subject="Mule Test with Velocity Transformer"
          to="#[flowVars['email']]" user="myemail%40gmail.com"  />

感谢您的回复,我认为CE不支持SMTP连接器,因为当我尝试它时,我会遇到其他错误。请看一下这个链接,你可以找到我的新代码和错误,谢谢。
ERROR 2015-03-29 17:40:36,648 [[pushv].cronsFlow2.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Failed to find entry point for component, the following resolvers tried but failed: [
MethodHeaderPropertyEntryPointResolver: The required property "method" is not set on the event
ReflectionEntryPointResolver: Could not find entry point on: "pushv.SendMail" with arguments: "{class java.util.LinkedHashMap}"
AnnotatedEntryPointResolver: Component: pushv.SendMail@13508f6 doesn't have any annotated methods, skipping.
CallableEntryPointResolver: Object "pushv.SendMail@13508f6" does not implement required interface "interface org.mule.api.lifecycle.Callable"
]
Code                  : MULE_ERROR-321
--------------------------------------------------------------------------------
Exception stack is:
1. Failed to find entry point for component, the following resolvers tried but failed: [
MethodHeaderPropertyEntryPointResolver: The required property "method" is not set on the event
ReflectionEntryPointResolver: Could not find entry point on: "pushv.SendMail" with arguments: "{class java.util.LinkedHashMap}"
AnnotatedEntryPointResolver: Component: pushv.SendMail@13508f6 doesn't have any annotated methods, skipping.
CallableEntryPointResolver: Object "pushv.SendMail@13508f6" does not implement required interface "interface org.mule.api.lifecycle.Callable"
] (org.mule.model.resolvers.EntryPointNotFoundException)
  org.mule.model.resolvers.DefaultEntryPointResolverSet:49 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.model.resolvers.EntryPointNotFoundException: Failed to find entry point for component, the following resolvers tried but failed: [
MethodHeaderPropertyEntryPointResolver: The required property "method" is not set on the event
ReflectionEntryPointResolver: Could not find entry point on: "pushv.SendMail" with arguments: "{class java.util.LinkedHashMap}"
AnnotatedEntryPointResolver: Component: pushv.SendMail@13508f6 doesn't have any annotated methods, skipping.
CallableEntryPointResolver: Object "pushv.SendMail@13508f6" does not implement required interface "interface org.mule.api.lifecycle.Callable"
]
    at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:49)
    at org.mule.component.DefaultComponentLifecycleAdapter.invoke(DefaultComponentLifecycleAdapter.java:339)
    at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:82)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
<set-payload value="Dear Mail Crawler,
                    \n\n No spam to my email, please!" doc:name="Set Payload"/>

<smtp:outbound-endpoint host="smtp.gmail.com" port="587" 
    user="myemail%40gmail.com" password="pass" to= "#[message.payload.email]"
    from="Rajeun" subject="Testing Subject" responseTimeout="10000" connector-ref="Gmail" doc:name="Send notification email"/>
<smtp:gmail-connector name="Gmail" validateConnections="true" doc:name="Gmail" contentType="text/html; charset=UTF-8"/>
  <smtp:outbound-endpoint host="smtp.gmail.com"  port="587" responseTimeout="10000" doc:name="SMTP" connector-ref="Gmail" from="Rajeun" password="pass" subject="Mule Test with Velocity Transformer"
          to="#[flowVars['email']]" user="myemail%40gmail.com"  />