我不能用骡子发邮件

时间:2015-03-26 12:36:40

标签: mule

当我尝试执行我的muleproject时,我收到了错误消息

  

"端点格式错误,无法解析"这是终点

以下是代码:

<smtp:outbound-endpoint host="smtp.gmail.com" user="mymail@gmail.com" password="mypass" 
to="destiny@gmail.com" from="my@gmail.com" responseTimeout="10000" 
doc:name="SMTP" port="587" subject="the subject"/>

错误在哪里?

我删除了&#34; @ gmail.com&#34;来自用户和项目现在已部署,但它会引发此异常

Root Exception stack trace:
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a      STARTTLS command first. cf12sm8298386wjb.10 - gsmtp

at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1829)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1368)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:886)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

这是完整的堆栈跟踪

    INFO  2015-03-26 22:26:00,479 [[domotica2].connector.smtp.mule.default.dispatcher.01] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.email.transformers.ObjectToMimeMessage
INFO  2015-03-26 22:26:00,499 [[domotica2].connector.smtp.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.smtp.mule.default.dispatcher.2081412619'. Object is: SmtpMessageDispatcher
INFO  2015-03-26 22:26:00,912 [[domotica2].connector.smtp.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.smtp.mule.default.dispatcher.2081412619'. Object is: SmtpMessageDispatcher
ERROR 2015-03-26 22:26:01,100 [[domotica2].connector.smtp.mule.default.dispatcher.01] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=smtp://mymail:<password>@smtp.gmail.com, connector=SmtpConnector
{
  name=connector.smtp.mule.default
  lifecycle=start
  this=77c233af
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[smtp]
  serviceOverrides=<none>
}
,  name='endpoint.smtp.mymail.gmail.com.587', mep=ONE_WAY, properties={fromAddress=mymail@gmail.com, toAddresses=destiny@gmail.com, subject=SD}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: MimeMessage
Code                  : MULE_ERROR-42999
--------------------------------------------------------------------------------
Exception stack is:
1. 530 5.7.0 Must issue a STARTTLS command first. md2sm586901wic.19 - gsmtp
 (com.sun.mail.smtp.SMTPSendFailedException)
  com.sun.mail.smtp.SMTPTransport:1829 (null)
2. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=smtp://mymail:<password>@smtp.gmail.com, connector=SmtpConnector
{
  name=connector.smtp.mule.default
  lifecycle=start
  this=77c233af
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[smtp]
  serviceOverrides=<none>
}
,  name='endpoint.smtp.mymail.gmail.com.587', mep=ONE_WAY, properties={fromAddress=mymail@gmail.com, toAddresses=destiny@gmail.com, subject=SD}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: MimeMessage (org.mule.api.transport.DispatchException)
  org.mule.transport.AbstractMessageDispatcher:117 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. md2sm586901wic.19 - gsmtp

    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1829)
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1368)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:886)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

3 个答案:

答案 0 :(得分:0)

实际上,这就是端点应该像删除“@ gmail.com”:

<smtp:outbound-endpoint host="smtp.gmail.com" user="mymail" password="mypass" to="destiny@gmail.com" from="my@gmail.com" responseTimeout="10000" doc:name="SMTP" port="587" subject="the subject"/>

或替换@代替:

<smtp:outbound-endpoint host="smtp.gmail.com" user="mymail%40gmail.com" password="mypass" to="destiny@gmail.com" from="my@gmail.com" responseTimeout="10000" doc:name="SMTP" port="587" subject="the subject"/>

答案 1 :(得分:0)

GMail SMTP的特定连接器名为smtp:gmail-connector

以下是一个示例用法:

<smtp:gmail-connector name="smtpGmailConnector"  bccAddresses="abc@example.com" ccAddresses="bcd@example.com" contentType="foo/bar"
fromAddress="cde@example.com" replyToAddresses="def@example.com"
subject="subject">
  <smtp:header key="foo" value="bar" />
  <smtp:header key="baz" value="boz" />
</smtp:gmail-connector>

参考:http://www.mulesoft.org/documentation/display/current/SMTP+Transport+Reference#SMTPTransportReference-Connectors(向下滚动,查看GMail连接器示例,在端点上方)。

答案 2 :(得分:0)

尝试删除@并将其替换为%40。