This should be a no brainer, but apparently I don't even qualify: I'm trying to send email via smtp. That's it. nothing fancy. Just an email. Here's My config:
<mule xmlns="
http://www.mulesource.org/schema/mule/core/2.1"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:vm="
http://www.mulesource.org/schema/mule/vm/2.1"
xmlns:spring="
http://www.springframework.org/schema/beans"
xmlns:context="
http://www.springframework.org/schema/context"
xmlns:file="
http://www.mulesource.org/schema/mule/file/2.1"
xmlns:jms="
http://www.mulesource.org/schema/mule/jms/2.1"
xmlns:smtp="
http://www.mulesource.org/schema/mule/smtp/2.1"
xmlns:email="
http://www.mulesource.org/schema/mule/email/2.1"
xmlns:xm="
http://www.mulesource.org/schema/mule/xml/2.1"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.mulesource.org/schema/mule/core/2.1 http://www.mulesource.org/schema/mule/core/2.1/mule.xsd http://www.mulesource.org/schema/mule/file/2.1 http://www.mulesource.org/schema/mule/file/2.1/mule-file.xsd http://www.mulesource.org/schema/mule/jms/2.1 http://www.mulesource.org/schema/mule/jms/2.1/mule-jms.xsd http://www.mulesource.org/schema/mule/smtp/2.1 http://www.mulesource.org/schema/mule/smtp/2.1/mule-smtp.xsd http://www.mulesource.org/schema/mule/email/2.1 http://www.mulesource.org/schema/mule/email/2.1/mule-email.xsd http://www.mulesource.org/schema/mule/vm/2.1 http://www.mulesource.org/schema/mule/vm/2.1/mule-vm.xsd http://www.mulesource.org/schema/mule/xml/2.1 http://www.mulesource.org/schema/mule/xml/2.1/mule-xml.xsd">
<smtp:connector name="smtpConnector" contentType="text/plain"
fromAddress="cde@example.com" replyToAddresses="def@example.com"
subject="subject">
<smtp:header key="foo" value="bar" />
<smtp:header key="baz" value="boz" />
</smtp:connector>
<email:string-to-email-transformer name="StringToEmailMessage"/>
<model>
<service name="muleMailService">
<description>This is an example use of the mule mailer service. this service
is a generic service that will mail a message to a group of recipients
It can configure the following:
group list of recipients
text/plain, text/html
</description>
<inbound>
<vm:inbound-endpoint path="mailPath" />
</inbound>
<outbound>
<pass-through-router>
<smtp:outbound-endpoint transformer-refs="StringToEmailMessage" host="MYSERVER" port="25" connector-ref="smtpConnector" />
</pass-through-router>
</outbound>
</service>
</model>
</mule>
===========================================
Things to note, the string to email transformer is applied, and it contains debug output that shows that it is working:
2009-01-06 11:42:36 | DEBUG | org.mule.transport.email.transformers.StringToEmailMessage | 249 | Object before transform: org.mule.transport.DefaultMessageAdapter/org.mule.transport.DefaultMessageAdapter@82254d{id=67adcf52-dc19-11dd-ac6a-4f28288f7b72, payload=java.lang.String, correlationId=67adcf52-dc19-11dd-ac6a-4f2828...
2009-01-06 11:42:36 | DEBUG | org.mule.transport.email.transformers.StringToEmailMessage | 114 | Constructing email using:
To: MYSERVER From: cde@example.comCC: nullBCC: nullSubject: subjectReplyTo: def@example.comContent type: text/plainPayload type: java.lang.StringCustom Headers: {baz=boz, foo=bar}
==================
if I try to route this through tcpmon using a different port, I can't get it to send the correct headers, because the transformer is what composes the javax.mail.message. If I use the port and host on the endpoint, then I get a "illegal character in internet address error" since the transformer concatenates the host and port, THEN validates it (I'll look into that more in the future and issue a JIRA if its real).
I can route it through tcpmon if I give it the mail port of 25 localhost, and point that to my mail server. Here is what tcpmon reports as my conversation (this would be coming out from Mule):
EHLO DHenton
QUIT
If I use tcpmon to monitor the conversation of a simple javax.mail message, the sent portion of the conversation looks like this:
EHLO DHenton
MAIL FROM:<testinfo>
RCPT TO:<dhenton@myserver.com>
DATA
From: testinfo
To: dhenton@anyserver.com
Message-ID: <29887233.01231257239595.JavaMail.dyh@DHenton>
Subject: Hello JavaMail
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Welcome to JavaMail
==================================================================
In my hands, MULE isn't forwarding the email message.
Any help would be appreciated. There should be a simple way to send email, but I'm dashed if I can get it to work.