当我尝试在Gmail中发送邮件时,我遇到了以下错误。在gmail全局连接器中,我添加了fromAddress,replyToAddress和all ....
********************************************************************************
WARN 2015-02-10 10:58:28,526 [[mailexample].connector.http.mule.default.receiver.02] org.mule.api.security.tls.TlsProperties: File tls-default.conf not found, using default configuration.
INFO 2015-02-10 10:58:31,354 [[mailexample].connector.http.mule.default.receiver.02] org.mule.api.security.tls.TlsPropertiesMapper: Defaulting mule.email.smtps trust store to client Key Store
WARN 2015-02-10 10:58:31,355 [[mailexample].connector.http.mule.default.receiver.02] org.mule.api.security.tls.TlsProperties: File tls-default.conf not found, using default configuration.
ERROR 2015-02-10 10:58:33,485 [[mailexample].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Unable to connect to mail transport.
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbuRg
534-5.7.14 yGa3WdTfxBAchlMvo6NtJgJK6JL823P9UTvFhfcpUfm5tgTi4Zzdsm1J9NfGCqjG4iAvCi
534-5.7.14 6BRop8ALCvZUrZ1sa9ICkR_u-WykguB7aGSc5jLH5mH1FGGlkusqWnqTyvE-AhRNcJo-PQ
534-5.7.14 rH1WuTiUITDEFdAlfy19PaiFDED6aos2shRxO4-jdEHzGGUTmgFXWUthbF5nSKBPq76Eb5
534-5.7.14 s5b7LbA> Please log in via your web browser and then try again.
534-5.7.14 Learn more at
534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 c17sm18040119pdl.6 - gsmtp
(javax.mail.AuthenticationFailedException)
com.sun.mail.smtp.SMTPTransport$Authenticator:648 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/mail/AuthenticationFailedException.html)
2. Unable to connect to mail transport. (org.mule.api.endpoint.EndpointException)
org.mule.transport.email.SmtpMessageDispatcher:67 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/endpoint/EndpointException.html)
在浏览器中我遇到以下错误
Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=smtp://<emailaddress>%40gmail.com:<password>@smtp.gmail.com, connector=GmailSmtpConnector
{
name=smtpGmailConnector
lifecycle=start
this=103a0ec
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[smtp]
serviceOverrides=<none>
}
, name='endpoint.smtp.emailaddress.gmail.com', mep=ONE_WAY, properties={toAddresses=to_emailaddress@gmail.com, subject=Test email message, fromAddress=emailaddress}, 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
以下是我的流程
<smtp:gmail-connector name="emailConnector" />
<flow name="mailTestFlow1" doc:name="mailTestFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"
path="sendMail"/>
<component doc:name="Java" class="Component1"/>
<smtp:outbound-endpoint host="smtp.gmail.com" port="587"
user="yourEmailAddress%40gmail.com" password="pass" to="javaroots@gmail.com"
from="yourEmailAddress%40gmail.com" subject="Testing mule" responseTimeout="10000" connector-ref="gmail" doc:name="Send notification email"/>
</flow>
现在,我必须做些什么改变?
答案 0 :(得分:2)
请您检查smtp端点中的以下条件
如果密码包含任何可以解码的字符,请指定解码后的密码。
通过提供@ gmail.com
3.指定<email:string-to-email-transformer/>
转换器
<smtp:outbound-endpoint ...... doc:name="email-notification">
<email:string-to-email-transformer/>
</smtp:outbound-endpoint>
希望这有帮助。
答案 1 :(得分:1)
根据the doc,GMail连接器需要配置非转义@
标志:
<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">
答案 2 :(得分:1)
您正在使用connector-ref =“gmail”。尝试使用connector-ref =“emailConnector”,它应该可以工作。
答案 3 :(得分:0)
我运行了以下配置:
<smtp:gmail-connector name="GmailConnector" contentType="text/html" validateConnections="true" doc:name="Gmail"/>
...
<smtp:outbound-endpoint host="smtp.gmail.com" port="587" user="${smtp.user}" password="${smtp.password}" connector-ref="GmailConnector" to="${smtp.to}" subject="${smtp.subject}" responseTimeout="10000" doc:name="SMTP"/>
config.properties文件包含:
#
# SMTP Configuration
#
smtp.user=focadiz
smtp.password=xXxXxXxXxX
smtp.to=email@domain.com
smtp.subject=Mule Notification